JacobDev1 / xl-converter

Easy-to-use image converter for modern formats. Supports multithreading, drag 'n drop, and downscaling.
https://codepoems.eu/xl-converter
Other
118 stars 4 forks source link

Some JPG files do not open for no apparent reason #26

Closed Ukhryuk-Hai closed 1 month ago

Ukhryuk-Hai commented 1 month ago

However, these files open perfectly in different image viewing programs and do not have any visual defects anywhere. Here is an example of such an image; there are 230 photos in this series, and the converter cannot process only one.

I suggest adding some JPG decoders and if an error occurs, try using them. Of course, it would be desirable for this situation to be displayed in the log.

JacobDev1 commented 1 month ago

I assume you mean "convert" when saying "open"?

This seems like a problem with JPEGLI. Temporarily switch the encoder to ImageMagick.

Unfortunately, there are rare cases where JPEGLI fails to process an image. The program uses cjpegli.exe from libjxl if you'd like to verify it.

I can't access the file to verify it myself. I suggest using GoFile or sending it to me via email at: contact@codepoems.eu

Ukhryuk-Hai commented 1 month ago

Here is the link.

Ukhryuk-Hai commented 1 month ago

Temporarily switch the encoder to ImageMagick.

How can i do this?

JacobDev1 commented 1 month ago

I assume you are talking about losslessly recompressing this JPEG into a JPEG XL file. cjxl produced the following output:

Encoding [JPEG, lossless transcode, effort: 7]
Error while decoding the JPEG image. It may be corrupt (e.g. truncated) or of an unsupported type (e.g. CMYK).
EncodeImageJXL() failed.

I'm afraid there is nothing I can do about it.

Ukhryuk-Hai commented 1 month ago

I assume you are talking about losslessly recompressing this JPEG into a JPEG XL file

Yes exactly. Why can't I use another decoder for such files? Or can convert them silently to RGB.

JacobDev1 commented 1 month ago

Because a different transcoder does not exist. The only alternative is to use the official library, but doing that in Python directly is not possible. There are no quality bindings available either. This also won't guarantee the image would process correctly.

JacobDev1 commented 1 month ago

Perhaps you could substitute a different decoder while using libjxl itself, but my program isn't doing that directly.

It's not something I can do, unfortunately.

JacobDev1 commented 1 month ago

Upon further investigation, the file appears to be corrupted. Even ExifTool refuses to write it:

$ exiftool -all= <file_name> 
Error: JPEG EOI marker not found - <file_name>
    0 image files updated
    1 files weren't updated due to errors