mozjpeg icon indicating copy to clipboard operation
mozjpeg copied to clipboard

How to get sample value for existing image for compression

Open shailenderjain opened this issue 3 years ago • 4 comments

Hello, While trying to use cjpeg for compression, i want to pass the sample value. The sample value should be equal to image which needs to be compressed. Is there any mechanism by which i can get the sample value for the image

shailenderjain avatar Mar 07 '21 03:03 shailenderjain

Hi @shailenderjain .

Jpegoptim ( https://github.com/tjko/jpegoptim ) with mozjpeg's libjpeg library will solve your "problem".

zvezdochiot avatar Mar 07 '21 06:03 zvezdochiot

What do you mean by sample? cjpeg takes -sample arg.

kornelski avatar Mar 07 '21 14:03 kornelski

I want to ensure if the files which i want to compress via mozjpeg should use the right sample plan. For e.g. if my image is using 1*1 then the same should be used by mozjpeg. It looks like if there is no parameter for mozjpeg then it could uses some DEFAULT parameter

shailenderjain avatar Mar 08 '21 12:03 shailenderjain

I see. This indeed isn't exposed in the demo command-line tool, and you'd need another libjpeg-based tool to choose correct subsampling for you.

I know https://github.com/imazen/imageflow is smart about it.

kornelski avatar Mar 08 '21 13:03 kornelski