Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can you retrieve the quality value you specify when you run cjpeg on a file and you want it from what you got? #442

Open
FredWahl opened this issue Jun 9, 2024 · 1 comment

Comments

@FredWahl
Copy link

FredWahl commented Jun 9, 2024

I have jpg files and I want to compress some of them if they are large enough and they haven’t already been compressed by tools like cjpeg or jpegmini. It makes no sense to compress a file that has rhe same quality or lower than what I specify when I run cjpeg. So i need some tool that gives me this value. Imagemagick does return a quality value which turns out to be something called ”compression quality” which i think is something different. When I run this on my original file, I got 93 and when I did the same on my compressed file, it returned 0 which isn’t very helpful. What I want is sometimes that returns the same value that i used in cjpeg.

@vkolesn
Copy link

vkolesn commented Jul 8, 2024

the quality value used for compression is not stored in the jpeg file -- it's not really needed for image reconstruction. if you have control over the initial compression, you can save that value as a comment in the jpeg file and then read it back. otherwise, there's no way to say exactly what -q value was used. also while -q is important, there are other factors that may significantly affect the quality so relying on -q exclusively may be misleading. you can get an estimate of the quality by checking DCT block statistics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants