GoogleChromeLabs / squoosh

Make images smaller using best-in-class codecs, right in the browser.
https://squoosh.app
Apache License 2.0
21.9k stars 1.54k forks source link

MozJPEG lossless transform #85

Open jakearchibald opened 6 years ago

jakearchibald commented 6 years ago

I don't know if this should be V1 or not…

Some JPEG encoders support lossless transforms, such as MozJPEG. We should enable this.

Currently our encoders take image data, so we need to figure out when it's acceptable to pass through the source file directly.

The options UI may need to be aware of when lossless transforms are possible.

ZeppLu commented 5 years ago

image Maybe I'm wrong, but doesn't a 100% quality indicate lossless transform?

jakearchibald commented 5 years ago

It doesn't, it means "run the MozJPEG encoder with a quality level of 100".

jakearchibald commented 5 years ago

(that's how it works in Photoshop etc too)

surma commented 5 years ago

Yeah, the setting of 100 will just use a higher resolution quantization table for the DCT transform. That part might be close to lossless, but it’s not guaranteed. Before we get to that stage, tho, the codec will:

which are all lossy steps.

jakearchibald commented 5 years ago

(I think mozjpeg disables chroma subsampling at qualities > 90)

ziemek99 commented 3 years ago

(I think mozjpeg disables chroma subsampling at qualities > 90)

You're right, MozJPEG disables it at qualities >= 90. You can use this image to make sure, it'll get darker if chroma subsampling is enabled.