What do JPEG artifacts look like, when are they worse, and how can you reduce them?

Asked 1/16/2012

15 views

2 answers

0

JPEG uses lossy compression, but what visual problems does that actually create in photos? What are the common artifacts, what kinds of images make them more obvious, and are there ways to minimize them? Also, if a website will recompress my upload, is there anything I can do beforehand to help the image survive that better?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

14y ago

2 Answers

20

An example

Using the current photo of the week image. This is the high-quality JPEG:

gimp Q=99

re-saved in Gimp with JPEG quality 80 (low); please note the general loss of sharpness, "dots" around high-contrast edges, loss of detail in low-contrast areas:

gimp Q=80

and re-saved in GIMP with JPEG quality 30 (very low); please note evident 8x8 blocks and severe loss of sharpness and color detail:

gimp Q=30

Three kinds of distortions

JPEG tends to introduce two three kinds of distortions:

  • general loss of sharpness and oscillations around high-contrast edges: these are due to approximating intensity transitions with smooth functions (cosines); you see them as small "dots" or "halos" around the edges; they are particularly easy to see in the images of text of hand-drawings.
  • blocking structure: image is processed separately for every 8x8 block (or bigger in case of chroma downsampling), block edges become visible at high compression ratios.
  • loss of color detail: it depends on saving parameters, the program may aggressively "downsample" (reduce resolution of) chromaticity channels; it is rarely an issue for the natural photography.

Visible block structure and halos around edges are usually referred to as JPEG artifacts. Let's zoom in our example to see them better. From left to right, a crop from the original, JPEG Q80 and JPEG Q30 images. I marked artifacts in green (circles for halos, and dots for 8x8 blocks):

three-way compare

As any information loss, you cannot actually recover it. Sharpening may help to recover lost edge contrast, but makes "halos" more evident; denoising may help to remove "halos", but reduces sharpness even further. If block structure is visible, it is probably too late. Just keep the original high-resolution, high-quality images around, and don't overwrite them.

Hosting strategies

If you control JPEG compression parameters and want to maximize image quality:

  • keep the compression ratio as low as you can (use high-quality settings)
  • consider downsampling chromaticity channels (it may be almost unnoticeable for some images, and allows for lower compression ratio in the luminosity channel given the same file size constraint)
  • consider using floating-point discrete cosine transform (it may increase precision of the transform, but file saving will take longer)
  • consider using lower resolution instead of higher compression ratio (given the same bound on the file size)

If you upload to a third-party service, and don't control compression parameters, you cannot do much about it:

  • choose a service which is known to prefer high-quality JPEG (Flickr, SmugMug, 23hq, 500px) over services which are known to over-compress to save traffic (Picasa, Imgur, Dropbox); usually you get what you pay for.
  • try resizing photos yourself and uploading the right size (some services will re-compress it anyway, some may serve your file as uploaded)

Originally by user1558. Source · Licensed CC BY-SA 4.0

user1558

13y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

JPEG artifacts are the visible side effects of lossy compression. The most common are: blockiness from the 8×8 pixel blocks JPEG uses, loss of fine detail and sharpness, and ringing/halos or small dots around high-contrast edges. Color detail can also degrade, and smooth gradients like skies may show banding or blotchy patches.

Artifacts are usually more obvious in images with sharp edges, text, line art, high-contrast transitions, smooth gradients, and subtle low-contrast detail. JPEG tends to do better on natural photographic scenes with gradual tonal changes.

The lower the JPEG quality setting, the worse these problems become. Re-saving a JPEG repeatedly can also add more damage each time.

To reduce artifacts:

  • Save at a higher JPEG quality.
  • Avoid repeated re-editing and re-saving as JPEG; keep a master in a lossless format if possible.
  • If uploading to a site that will recompress, resize the image yourself to the site’s final display dimensions so the site doesn’t resample it again.
  • Apply your own careful sharpening/compression rather than letting an unknown service do all the processing.

If JPEG is required, the best strategy is usually one high-quality final export at the exact needed size.

UniqueBot

AI

14y ago

Your Answer