ConvertX icon indicating copy to clipboard operation
ConvertX copied to clipboard

Converting PNG to JPG via `imagemagick`

Open StrangeRanger opened this issue 8 months ago • 3 comments

Describe the bug

I made a previous bug report indicating that converting a PNG into a JPG worked completely fine (#320), but when going back, I found a problem with this, too. After I upload a PNG and it gets successfully converted with imagemagick, I go to download it, but I'm unable to do so. For some reason, imagemagick breaks the images into several files such as image-name-0.jpg and image-name-18.jpg. So when trying to download image-name.jpg, it fails. This is not the case when using something like ffmpeg.

❯ docker compose up   
[+] Running 2/2
 ✔ Network convertx_default  Created                                                                                                                                                                                                   0.1s 
 ✔ Container convertx        Created                                                                                                                                                                                                   0.3s 
Attaching to convertx
convertx  | ConvertX v0.14.1
convertx  | 🦊 Elysia is running at http://localhost:3000
convertx  | ImageMagick 7.1.1-43 Q16 aarch64 22550 https://imagemagick.org
convertx  | Bun v1.2.2
convertx  | Debian GNU/Linux 13 (trixie)
convertx  | potrace 1.16. Copyright (C) 2001-2019 Peter Selinger.
convertx  | resvg v0.45.1
convertx  | libheif v1.19.8
convertx  | djxl v0.11.1 [NEON,NEON_WITHOUT_AES]
convertx  | XeTeX 3.141592653-2.6-0.999996 (TeX Live 2025/dev/Debian)
convertx  | GraphicsMagick 1.4 snapshot-20250331 Q16 http://www.GraphicsMagick.org/
convertx  | assimp Version 5.4 -debug -shared -st (GIT commit 0)
convertx  | ebook-convert (calibre 8.4.0)
convertx  | vips-8.16.1
convertx  | Inkscape 1.4 (e7c3feb100, 2024-10-09)
convertx  | ffmpeg version 7.1.1-1+b1 Copyright (c) 2000-2025 the FFmpeg developers
convertx  | pandoc 3.1.11.1
convertx  | ENOENT: no such file or directory, open './data/output/1/1/A Garden.jpg'
convertx  |     path: "./data/output/1/1/A Garden.jpg",
convertx  |  syscall: "open",
convertx  |    errno: -2,
convertx  |     code: "ENOENT"
convertx  | 
convertx  | ENOENT: no such file or directory, open './data/output/1/1/A Garden.jpg'
convertx  |     path: "./data/output/1/1/A Garden.jpg",
convertx  |  syscall: "open",
convertx  |    errno: -2,
convertx  |     code: "ENOENT"
convertx  | 
convertx  | jobId set to: 2
convertx  | Converted ./data/uploads/1/2/A Garden.png from png to jpeg successfully using ffmpeg. Done
convertx  | stderr: ffmpeg version 7.1.1-1+b1 Copyright (c) 2000-2025 the FFmpeg developers
convertx  |   built with gcc 14 (Debian 14.2.0-18)
convertx  |   configuration: --prefix=/usr --extra-version=1+b1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --disable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
convertx  |   libavutil      59. 39.100 / 59. 39.100
convertx  |   libavcodec     61. 19.101 / 61. 19.101
convertx  |   libavformat    61.  7.100 / 61.  7.100
convertx  |   libavdevice    61.  3.100 / 61.  3.100
convertx  |   libavfilter    10.  4.100 / 10.  4.100
convertx  |   libswscale      8.  3.100 /  8.  3.100
convertx  |   libswresample   5.  3.100 /  5.  3.100
convertx  |   libpostproc    58.  3.100 / 58.  3.100
convertx  | Input #0, psd_pipe, from './data/uploads/1/2/A Garden.png':
convertx  |   Duration: N/A, bitrate: N/A
convertx  |   Stream #0:0: Video: psd, gbrp, 3000x2400, 25 fps, 25 tbr, 25 tbn
convertx  | Stream mapping:
convertx  |   Stream #0:0 -> #0:0 (psd (native) -> mjpeg (native))
convertx  | Press [q] to stop, [?] for help
convertx  | Output #0, image2, to './data/output/1/2/A Garden.jpg':
convertx  |   Metadata:
convertx  |     encoder         : Lavf61.7.100
convertx  |   Stream #0:0: Video: mjpeg, yuv444p(pc, progressive), 3000x2400, q=2-31, 200 kb/s, 25 fps, 25 tbn
convertx  |       Metadata:
convertx  |         encoder         : Lavc61.19.101 mjpeg
convertx  |       Side data:
convertx  |         cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
convertx  | [image2 @ 0xaaab02f5b950] The specified filename './data/output/1/2/A Garden.jpg' does not contain an image sequence pattern or a pattern is invalid.
convertx  | [image2 @ 0xaaab02f5b950] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image.
convertx  | [out#0/image2 @ 0xaaab02f5a560] video:541KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
convertx  | frame=    1 fps=0.0 q=11.1 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.107x    
convertx  | 
convertx  | jobId set to: 3
convertx  | Converted ./data/uploads/1/3/A Garden.png from png to jpeg successfully using imagemagick. Done
convertx  | ENOENT: no such file or directory, open './data/output/1/3/A Garden.jpg'
convertx  |     path: "./data/output/1/3/A Garden.jpg",
convertx  |  syscall: "open",
convertx  |    errno: -2,
convertx  |     code: "ENOENT"
convertx  | 

To Reproduce Steps to reproduce the behavior:

  1. Upload a PNG for conversion.
  2. Select conversion to JPG using imagemagick
  3. Initiate conversion.
  4. Wait for the conversion to finish.
  5. Try to download the image.
  6. See in the download tab of your browser, say something like "Site wasn't available", meaning it couldn't download the image.
  7. You can also then look at the ./data directory where the conversion took place, and see that the files were broken into several ones.

Checklist:

  • [x] I am accessing ConvertX over HTTPS or have HTTP_ALLOWED=true

EDIT:

After some additional testing, I wonder if it's because of the file size I'm uploading for conversion. The particular file is about 30 MB. Anything, at least from the small set of images I tested, that was around 3-4 MB and below worked completely fine.

StrangeRanger avatar Jun 07 '25 18:06 StrangeRanger

does the big file work with vips?

C4illin avatar Jun 08 '25 19:06 C4illin

It does seem to work with vips, specifically with jpeg and jp2. Didn't try the other ones.

StrangeRanger avatar Jun 08 '25 20:06 StrangeRanger

I followed the same steps and uploaded the .png file over 30MB, and it converted perfectly to .JPG. Attached a

Image

Screenshot of the completion.

SAHIL-Sharma21 avatar Aug 03 '25 17:08 SAHIL-Sharma21