JPEG is a lossy format: every save throws away detail, and the damage shows first as blockiness in flat areas and halos around sharp edges. Google web.dev notes that JPEG is a lossy format and that you should try several quality levels to find the right one, and that PNG is better for images with sharp lines. Check the JPEG export at full size before it is used, and pick the quality where the artifacts disappear.
What you need
- The AI-generated image at full resolution
- A JPEG encoder with a quality setting
- A zoomed-in view of flat areas and edges
Step 1: Export the image as JPEG at a known quality
Export the image as JPEG with a quality setting you record, for example 85. Note the file size of the export.
Step 2: Inspect flat areas and sharp edges at full size
Zoom to full size and look at flat areas of colour for blocks, and at sharp edges for halos or ringing. Check faces, text and logos most carefully, since artifacts there are the most visible.
Step 3: Raise the quality or switch format if artifacts show
If artifacts are visible, raise the JPEG quality and export again, or switch to PNG or WebP if the image has sharp lines or flat colour. Keep the smallest file that shows no artifacts.
Worked example: synthetic JPEG artifact check of one image
The table below is a synthetic example. It shows the expected result of testing three JPEG quality settings; no image was published.
| Quality setting | File size | Artifacts | Verdict |
|---|---|---|---|
| JPEG q60 | 52 KB | Blocks in sky | Fail |
| JPEG q85 | 96 KB | None visible | Pass |
| JPEG q95 | 148 KB | None visible | Pass – larger |
Expected result (UNTESTED). q60 shows blocks in the sky and fails, q85 is clean at 96 KB, and q95 is clean but larger, so q85 is the setting to use. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- JPEG compression is cumulative, so never re-save a JPEG as a JPEG if you can avoid it; keep the original.
- A quality setting that looks clean on screen can still show artifacts in print, so check the print version separately.
- Images with sharp text or logos suit PNG better than JPEG, so check the format choice as well as the quality.
- File size is a guide, not a verdict: a small file with visible artifacts is worse than a larger clean one.
