Guide

JPEG quality 80 is not the same setting in every encoder

At quality 80, the beach photograph became a 177,603-byte JPEG with libjpeg-turbo and a 144,384-byte JPEG with MozJPEG. Both used 4:2:0 colour sampling and baseline encoding, but their stored quantization tables differed. Copying the number 80 from one export tool to another would not reproduce the same settings.

Last updated:

Bitinz team · How we write and check our content

The test kept sampling and scan layout fixed

We encoded three inputs at quality 50, 80 and 95 to find out what those familiar numbers actually select, not to name a winning encoder. A smaller output can reflect a different choice about which details to keep, so we kept the originals and examined the same small regions in every output.

The encoders were libjpeg-turbo 3.2.0 and MozJPEG 4.1.5, built from its official source.

Two inputs were sizes of the same beach photograph from Pexels, 1400 × 933 and 5760 × 3840 pixels, so they show one scene. The third was an original 1024 × 640 document-management interface captured in Chrome, with small red warning text, black text and pale panels.

We prepared each input once as an opaque, correctly oriented 8-bit sRGB PPM, and both encoders read exactly the same PPM bytes. The photographs began as JPEGs, so this tests exports from those decoded images, not development from camera raw files.

Both tools received -sample 2x2,1x1,1x1 -baseline -optimize, but -baseline means different things in each. In libjpeg-turbo it limits the quantization tables to 8-bit values, and baseline output is already the default. In MozJPEG it turns off the default progressive coding. The frame headers confirmed that all 18 files were baseline JPEGs with 4:2:0 sampling.

File sizes at quality 50, 80 and 95

InputQualitylibjpeg-turbo bytesMozJPEG bytes
Beach5093,67870,787
Beach80177,603144,384
Beach95327,773298,227
Large photograph50990,416819,376
Large photograph802,276,3642,071,237
Large photograph953,395,8692,916,117
Interface5026,51421,560
Interface8038,37633,048
Interface9561,60856,058

A higher number gave a larger file in every series, but the gap between the encoders did not stay constant. At quality 80, MozJPEG's file was 18.7% smaller for the beach, 9.0% for the large photograph and 13.9% for the interface, measured against the libjpeg-turbo file.

These are byte counts at the same requested number, not at the same visual result. The gap changed from image to image, so three files cannot support a conversion such as one tool's 80 equalling the other's 75. Comparing efficiency would mean adjusting the settings until the same crops look alike, which we did not do.

The detail behind the byte counts

We opened the source and both quality-80 outputs in Google Chrome 157.0.8103.78 on macOS 27.0.1. The crops show the same 160 × 110 beach region and 160 × 70 interface region from each file, enlarged three times with nearest-neighbour scaling.

Source

Driftwood detail from the source photograph, enlarged three times.

libjpeg-turbo, quality 80

The same driftwood detail from the libjpeg-turbo file.

MozJPEG, quality 80

The same driftwood detail from the MozJPEG file, with smoother wood grain.
Look at the fine grain in the dark wood and the bright edge across the lower part of the crop. MozJPEG's version is smoother, with less wood texture and softer light edges than libjpeg-turbo's.

Source

Red and black interface text from the source PNG, enlarged three times.

libjpeg-turbo, quality 80

The same interface text from the libjpeg-turbo file.

MozJPEG, quality 80

The same interface text from the MozJPEG file, with paler, softer red letters.
Compare the thin red strokes with the source. In the MozJPEG version the red is paler and the stroke edges are more blurred. Both JPEG versions change the lettering; neither keeps the PNG source exactly.

The smaller quality-80 file did not keep the same visible detail in these crops. Fixing the sampling removed one variable, but it did not make the two encoders' quality controls equivalent.

What the JPEG header says

A JPEG stores quantization tables, not the quality number from the export dialogue. The decoder uses those tables and the image data; the encoder decides how its quality control maps to the tables and to its other choices.

We read both tables from every output. At a given quality value, each encoder used the same tables for all three inputs, but the two encoders' tables were different.

libjpeg-turbo, quality 80

The 8 by 8 libjpeg-turbo luminance table at quality 80, starting 6, 4, 4 and ending 40.

MozJPEG, quality 80

The 8 by 8 MozJPEG luminance table at quality 80, starting 6, 6, 6 and ending 167.
Quantization steps, not pixels; low spatial frequencies are at the upper left. MozJPEG's steps climb toward the bottom right to 167, while libjpeg-turbo's stay at 48 or below.

The quality-80 luminance tables differed in 61 of 64 entries. MozJPEG's steps were larger in 53 positions, smaller in 8 and equal in 3. Both tables began with 6; the next two entries were 4 and 4 for libjpeg-turbo and 6 and 6 for MozJPEG, and the bottom-right entries were 40 and 167.

A larger step keeps less precision for that coefficient. At the same “80”, MozJPEG was set to discard more detail in most positions, which matches the smoother wood and softer lettering in the crops and, together with the encoder's other choices, helps explain its smaller files. The ratio 167:40 is not a fourfold quality difference; these are steps for one spatial-frequency position, not a scale of visual quality.

Check an export before carrying its number into another tool

Start from the same source in both tools and keep the dimensions, colour conversion, sampling and progressive or baseline mode fixed. Then compare bytes and the same crop. Enlarged crops show where the differences are; check at 100% and at the size you will display as well, where some of them fade. Change one setting at a time.

Our verified command for the installed libjpeg-turbo encoder was:

cjpeg -quality 80 -sample 2x2,1x1,1x1 -baseline -optimize \
  -outfile photo-turbo-80.jpg photo.ppm

MozJPEG's cjpeg accepted the same options. A command called cjpeg may belong to either encoder, so run cjpeg -version and note the result before comparing files.

To read the tables with libjpeg-turbo's decoder, we verified this command on both quality-80 files:

djpeg -verbose -verbose -outfile /dev/null photo.jpg

It writes diagnostic output to stderr. Look for Define Quantization Table 0 for the luminance table and table 1 for the colour channels; each appears as eight rows of eight values in natural order. On both of our quality-80 files, every printed value matched the tables we extracted.

File-inspection tools may also estimate a “quality” value. We tested ImageMagick on the two beach files:

magick identify -format '%f %Q\n' photo-turbo-80.jpg photo-mozjpeg-80.jpg

It reported 80 for the libjpeg-turbo file and 50 for MozJPEG's, although both were made with -quality 80. Such an estimate is the tool's reading of the stored tables, not the number originally given to the encoder.

When you move an image pipeline to another encoder, keep a small set of representative files, including a photograph with fine texture and a screenshot with coloured text, and record the encoder version and options with the quality value. The same check works for an online tool such as Bitinz: compress the same source and inspect the same crops. For background, read lossy vs lossless compression and the chroma subsampling test.

Compress imagesMake JPG, PNG and WebP files smaller in their own format, in batches and for free.Compress images

FAQ

Is quality 80 an 80% copy of the original?
No. JPEG does not define that number as a percentage of pixels, detail or file size kept. Treat it as a control within one encoder and inspect the result: our quality-80 files had different tables and sizes despite receiving the same pixels.
Can a smaller JPEG at the same number be called more efficient?
Not from the byte count alone. Our table shows smaller files at the same requested number, not at equal visual quality. Raise the number for the softer output until the same crops look alike, then compare the byte counts, checking both 100% and the display size.
Will quality 100 make a JPEG lossless?
No. With libjpeg-turbo, quality 100 sets every quantization-table entry to 1, but colour subsampling and rounding can still lose information. When exact decoded pixels are required, keep a lossless format and verify the pixels instead of exporting JPEG again.

Tools in this guide

Sources

  1. Bitinz: JPEG quality test: files, measurements and commands (2026-11-16)
  2. libjpeg-turbo: cjpeg usage
  3. MozJPEG: MozJPEG 4.1.5 usage
  4. MozJPEG: MozJPEG 4.1.5 quantization tables and quality scaling (jcparam.c)
  5. ITU-T: Recommendation T.81 (JPEG): quantization tables