mozilla / mozjpeg

Improved JPEG encoder.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get sample value for existing image for compression

shailenderjain opened this issue · 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

Hi @shailenderjain .

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

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

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

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.