mozjpeg icon indicating copy to clipboard operation
mozjpeg copied to clipboard

hence preserving quality from .jpg input to output in cjpeg

Open kowpa1990 opened this issue 10 years ago • 1 comments

Already for some time I use the new cjpeg but nowhere hadn't seen such an option. Normally, you need to choose a quality level or cjpeg chooses the value of 75.

Preserving quality factor from jpg source. example:

1. ffmpeg.exe -i file.png -c:v mjpeg -q:v 31 -pix_fmt yuvj420p out.jpg

(This creates a jpg file with unusual quantization tables.)

2. cjpeg -quality copy out.jpg > cjpegout.jpg

cjpeg reads qtables from the file, saves in the cache, and executes something like this:

cjpeg -qtables <cache> -qslots 0 out.jpg > cjpegout.jpg

DCTune for example, uses a separate quantization tables for each component, so we have to be careful with -qtables and -qslots.

Files saved in this way using mozjpeg (when I set manually -qtables) look almost identical to the source, and are a bit smaller.

In addition to the option described above You should introduce -copy none (in cjpeg) so that I could stop using jpegtran ;)

kowpa1990 avatar Jul 20 '14 19:07 kowpa1990

I am not understanding why you would want to reencode the file with the same quant table instead of using jpegtran to optimize it.

CoolOppo avatar Aug 09 '16 22:08 CoolOppo