Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jpeg compression ratio

Is there a table that gives the compression ratio of a jpeg image at a given quality?

Something like the table given on the wiki page, except for more values.

A formula could also do the trick.

Bonus: Are the [compression ratio] values on the wiki page roughly true for all images? Does the ratio depend on what the image is and the size of the image?

Purpose of these questions: I am trying to determine the upper bound of the size of a compressed image for a given quality.

Note: I am not looking to make a table myself(I already have). I am looking for other data to check with my own.

like image 621
VSC Avatar asked Aug 12 '10 20:08

VSC


People also ask

What is the best compression ratio for JPEG images?

The best compression ratio to retain image quality is 10:1.

What is a good size for a JPEG?

2400x1600px, jpeg, saved for web, and optimized To ensure that your full width images look good across any device big or small the recommended size is 2400x1600px. Note that devices have different ratio than the one you shoot and it is possible your images will be cropped when viewed on web.


1 Answers

I had exactly the same question and I was disappointed that no one created such table (studies based on a single classic Lena image or JPEG tombstone are looking ridiculous). That's why I made my own study. I cannot say that it is perfect, but it is definitely better than others.

I took 60 real life photos from different devices with different dimensions. I created a script which compress them with different JPEG quality values (it uses our company imaging library, but it is based on libjpeg, so it should be fine for other software as well) and saved results to CSV file. After some Excel magic, I came to the following values (note, I did not calculated anything for JPEG quality lower than 55 as they seem to be useless to me):

Q=55    43.27
Q=60    36.90
Q=65    34.24
Q=70    31.50
Q=75    26.00
Q=80    25.06
Q=85    19.08
Q=90    14.30
Q=95    9.88
Q=100   5.27

To tell the truth, the dispersion of the values is significant (e.g. for Q=55 min compression ratio is 22.91 while max value is 116.55) and the distribution is not normal. So it is not so easy to understand what value should be taken as typical for a specific JPEG quality. But I think these values are good as a rough estimate.

I wrote a blog post which explains how I received these numbers.

http://www.graphicsmill.com/blog/2014/11/06/Compression-ratio-for-different-JPEG-quality-values

Hopefully anyone will find it useful.

like image 86
Andrew Simontsev Avatar answered Oct 07 '22 17:10

Andrew Simontsev