mozjpeg
mozjpeg copied to clipboard
jpegtran lossy for corrupted file
After this:
jpegtran -outfile 5c67195f6993c9f8d0d32d4ffe0d8e62_mozjpeg.jpg 5c67195f6993c9f8d0d32d4ffe0d8e62.jpg
some pixels slightly changed.
5c67195f6993c9f8d0d32d4ffe0d8e62.jpg:
5c67195f6993c9f8d0d32d4ffe0d8e62_mozjpeg.jpg:
This file is from https://github.com/MozillaSecurity/fuzzdata/blob/master/samples/jpg/5c67195f6993c9f8d0d32d4ffe0d8e62.jpg some other files in that directory also have this issue.
The input file is corrupted, so it's not entirely surprising.
Yes, the file is malformed, which is good for testing edge cases. The file can be opened by major browsers and photo viewers without error, so I'd expect mozjpeg could handle this file correctly (lossless).
This isn't really an edge-case. It's a corrupt file. The solution here is to make mozjpeg warn when the input is corrupt, but I really don't see the point in wasting time trying to make it tiptoe around corrupt files in order to preserve the already corrupt data.