danielgtaylor/jpeg-archive

Looking for some clarification on the code's capabilities

dunstan opened this issue · 2 comments

I initially thought from the documentation that I could run jpeg-recompress against a high quality jpeg and it would produce a visually identical jpeg at a reduced file size: "Compress JPEGs by re-encoding to the smallest JPEG quality while keeping perceived visual quality the same ... This is a lossy operation, but the images are visually identical..."

However, two things confuse me and I wondered if you could clarify them for me so I can get the most out of this excellent code?

  1. Some of the images that are produced show a lot of those strange jpeg compression blocks and striated shadows. I originally found that issue using "jpeg-recompress --quality high --accurate --method smallfry --min 60 input.jpg output.jpg". I switched to SSIM and had better luck, but I'm confused as I thought the whole point was that it would always save out something that was visually identical to the input? Am I misunderstanding that? Or would this be a bug?

  2. The quality settings also confuse me. If the script is supposed to produce visually identical images at "Medium" setting, what are the High and Veryhigh settings for? And equally, does Low imply that the output will be less visually identical? I'm confused.

Thanks for any clarification you can offer me on these points, and for all the hard work you've put into this.

Original 100% quality JPEG from photoshop
orig-100
--quality medium --loops 20 --method ssim --accurate
ssim-medium

--quality high --loops 20 --method ssim --accurate
ssim-high

--quality medium --loops 20 --method smallfry --accurate
smallfry-medium

--quality high --loops 20 --method smallfry --accurate
smallfry-high

lfos commented

Being "visually identical" is not a Boolean property. If the image is small enough (or you are far away), every pair of images becomes "visually identical". Conversely, with massive zooming and contrast, every pair of (not 100% identical) images becomes "visually distinguishable". There always is a tradeoff between space efficiency and visual quality. That is why we have the different quality options.

With high, you should be pretty much on the safe side. If you have examples where the quality when using high is quite bad and visible without zooming, please let us know.

Ah, okay, thank you. In that case the images I attached would serve as good examples of outcomes that are clearly different than the input. At every zoom level the striated shadows on the smallfry versions are obvious. I wouldn't expect that.