mozjpeg icon indicating copy to clipboard operation
mozjpeg copied to clipboard

cjpeg -restart X corrupts image

Open tuttle opened this issue 9 years ago • 9 comments

Using -restart 1 leaves me with image having large horiz bands of colors and greyscale. Using -restart 100 the result has colors strongly blurred. Compiled on Ubuntu 14.04. Tested also with mozjpeg built on Jan 2015, same results.

tuttle avatar Dec 06 '15 11:12 tuttle

Adding -sample 1x1 appears to solve the issue, but the doc does not mention it AFAIK.

tuttle avatar Dec 06 '15 11:12 tuttle

I'm curious, what do you use the markers for?

I wouldn't be surprised if it was a forgotten feature that's got broken.

kornelski avatar Dec 06 '15 23:12 kornelski

I was astonished how effective mozjpeg's compression is so I was considering to use it on our family photo archive as digital cameras make giant files and there's a little need to archive all those bytes. So I was going through the docs, testing and researching the options to come up with the best settings for mass conversion. Restart markers reminded me of similar nifty self-healing features in other formats/protocols. As I saw quite a few image corruptions in the past going from some position to the bottom, I just wanted to try the option to see what's the byte cost. :-) I understand it might be seldom used these days.

tuttle avatar Dec 07 '15 18:12 tuttle

I see. Archival sounds like a good use case for it.

kornelski avatar Dec 08 '15 01:12 kornelski

@tuttle Do you see this bug in libjpeg-turbo? I'm wondering if this is specific to mozjpeg.

bdaehlie avatar May 25 '16 13:05 bdaehlie

sorry, no idea

tuttle avatar May 25 '16 13:05 tuttle

@pornel Do you want to look into this or should we close it? If we don't even know if this is specific to mozjpeg then I think we should just close it.

bdaehlie avatar May 26 '16 12:05 bdaehlie

I've checked and it's mozjpeg-specific bug. Happens only in mozjpeg and only when optimization of progressive scans is enabled.

-restart works in conjunction with -fastcrush

In this case we could say restart markers and scan optimizations are mutually exclusive options and ignore one when the other is enabled.

kornelski avatar May 26 '16 16:05 kornelski

Personally it'd prefer a fatal user error instead of silent ignore. It would save some time and/or confusion of the ppl like me who experiment. Thanks. Just my $.02

tuttle avatar May 26 '16 17:05 tuttle