How to Estimate JPEG Quality From the File

You can estimate JPEG quality by examining the quantization tables inside the file and comparing them with the tables produced by a known JPEG encoder. A close match can suggest a slider setting such as 80 on that encoder’s scale. However, the file rarely tells you the exact slider setting someone used, and the estimate cannot tell you how sharp the original photo was.

Before exporting the file again, compare JPEG, PNG and WebP.

What “JPEG quality” can mean

MeaningWhat it tells youWhat it leaves out
Export quality settingThe value an app passes to its encoder, often from 1 to 100What a different app would produce at the same number
Quality estimateA likely value on a named scale, based on the tables inside the fileWhat setting an unknown app actually displayed
Visual qualityWhether people can see the detail they need at the intended sizeHow closely the picture matches an unavailable original
File sizeHow many bytes the JPEG containsWhether the image is sharp or the encoder used an aggressive setting

Suppose one photo takes 80 KB and another takes 250 KB. The smaller file may depict a smooth studio backdrop, while the larger file shows a crowd with fine detail. Therefore, the size difference alone does not tell you which encoder used the higher quality setting. Similarly, camera blur can make a high-quality export look soft even when it shows no obvious block edges.

What a JPEG quantization table does

Most ordinary JPEG photos split their image information into small blocks. In a typical encoder, the discrete cosine transform describes a block using a base value and a set of patterns that represent changes within that block. Some patterns describe broad areas of colour or brightness. Others describe rapid changes, such as narrow lines and fine texture.

Next, the encoder uses a quantization table to decide how precisely to store each kind of pattern. Larger table values generally represent that part of the block more coarsely. Then rounding can turn some transformed values into zeros, which helps the encoder reduce file size. The JPEG decoder needs those table values to reconstruct the image, so the file carries them as part of its compressed data.

Most colour JPEGs use a table for brightness and one or more related tables for colour components. A greyscale file may only use one. Also, colour subsampling can reduce the amount of colour information before quantization even takes place. As a result, two files can use similar quantization tables but differ around small coloured text.

How to estimate the setting from the file

  1. Read the JPEG structure. Use a JPEG-aware inspector that can read the Define Quantization Table marker, often abbreviated as DQT. Also check which image components reference each table.
  2. Choose a reference family. For example, use the Independent JPEG Group’s reference approach if you want an estimate on a common libjpeg-style scale. Define the exact reference instead of treating every encoder as equivalent.
  3. Compare the effective tables. Generate the reference tables for each candidate setting and compare them to the ones in the photo. Keep coefficient order consistent, since tools may display values in a different order from the file.
  4. Record the closest result and its limitations. If both brightness and colour tables agree, report the likely setting on that reference scale. However, if one table matches and the other differs, report a partial match or an unknown result.
  5. Inspect the image itself. Finally, check important areas at the size people will actually see. A table match can help you describe the current export, but the appearance still decides whether the file is fit to use.

The Independent JPEG Group reference implementation shows how its encoder scales standard tables for different settings. The numbers change in a particular way for that implementation. An app that chooses its own tables or uses separate colour and brightness settings can produce a valid JPEG that has no exact match on that scale.

Why a perfect match may still tell only part of the story

First, rounding can make different candidate settings hard to distinguish, particularly when table entries reach their allowed limits. Therefore, if more than one candidate matches your comparison, report a range instead of implying more certainty than the evidence supports.

Second, a JPEG can go through several exports. If a social platform takes a user’s JPEG and recompresses it, the tables you inspect describe the later encoding. They typically do not reveal the exact earlier settings. For example, a strongly compressed copy could later receive a high-quality re-export without regaining any lost detail. A high estimate on the final file would not remove the earlier artifacts.

Third, the encoder can optimise other parts of the file. Metadata, colour subsampling, and entropy coding can affect file size independently of an estimated setting. Progressive JPEG can also organise image data in a different sequence from a baseline file. Accordingly, treat the estimate as one observation about the compressed data and keep the other checks separate.

A worked example for a photo editor

Imagine a client sends a JPEG with no editing history. Your inspector reports that its brightness and colour tables closely match the reference tables for setting 82. You can record “approximately 82 on the reference scale.” Then open the file and check its most important detail, such as a face or the stitching on clothing. If it looks clean at the required display size, you may be able to use that copy.

Now imagine the same estimate appears on a photo with square patches in dark areas. Ask for the original if it is available. If it is not, decide whether those patches matter on the final page. For a small preview, you might use an image resizer to prepare the needed width from the cleanest available source. However, changing dimensions or re-exporting at a high setting cannot restore the original detail. Use the compression artifacts guide to distinguish block edges from blur or sharpening.

Frequently asked questions

1. Does JPEG store the original quality number?

A standard JPEG carries the information needed to decode the image, including its quantization tables. However, it does not require a universal slider value. Some apps add their own metadata, but that depends on the encoder.

2. Is a quality estimate of 90 always better than 80?

No. Those numbers can describe one encoder’s settings. The appearance also depends on the source, pixel dimensions, subsampling, and earlier edits or compression.

3. Can I estimate quality from the file size?

File size alone is insufficient. Two photos with the same dimensions and export settings can occupy different amounts of space because their image detail differs.

4. Can I tell whether a JPEG has been compressed twice?

Sometimes an expert can find signs of earlier encoding, but a simple quality estimate cannot confirm the file’s export history. The original or a known earlier copy makes comparisons much more reliable.

5. Do progressive JPEGs use different quality numbers?

A progressive JPEG delivers image data in multiple scans. That layout does not by itself define the quality value. To estimate the setting, inspect the tables and use the same reference method.

6. Can I raise the slider to recover lost detail?

No. A higher setting can limit further loss in a fresh export, but it cannot reconstruct information discarded earlier. If you still have the original, start from that file.

7. What should I report if the tables do not match?

Report the encoder family as unknown or give a qualified estimate. Include the reference scale and explain whether both tables agreed. When all you need is a usable image, describe the visible result too.

Decide what the estimate is for

If you need to document the encoding, name the reference scale and the strength of the match. If you need to pick an image for a page, inspect the correct display size, check the actual file weight, and use a fresh export when you can. The tables help explain the file, while the side-by-side view helps you decide what to publish.

About the author

Picture of Pic Resize Image

Pic Resize Image

Pic Resize Image publishes practical guides on resizing, cropping, and compressing images for websites, email, and online forms.