1
\$\begingroup\$

What causes this effect? The boundaries look chunky and weird. I never seen this on PNG.

I also have noticed this for JPEG images only, not PNG. For example these captcha images. The skies don't appear clear and natural at all, they appear speckled with random magenta, yellow and cyan pixels. Why does this happen in JPEG images? Can someone explain what causes this? Is this caused by some sort of lossy compression?

Also, with JPEG images containing noise and chunky boundaries, why are they so popular? If PNG doesn't suffer from these problems?

\$\endgroup\$

1 Answer 1

5
\$\begingroup\$

This is the nature of lossy JPEG compression. The compression process works by splitting an image into 8x8 pixel patches, and compressing each of them individually, with no concern for the boundary conditions where each patch joins with its neighbors. The theory is that very small details can be modified and/or discarded without our visual system taking too much notice. As a result, discontinuities show up on the edges of these patches, and become more noticeable at higher compression (or, alternatively, lower quality) settings. In the extreme, the compression algorithm could theoretically convert each patch into a single color, which would be pretty similar to scaling a picture down by a factor of 8, and then scaling it back up by simply replicating pixels.

PNG compression, on the other hand, does nothing to modify the actual pixel colors. It applies a lossless compression algorithm to the image contents, which, depending on the contents of the image, can vary widely in its effectiveness - highly detailed images compress less, while a more uniform image would compress better. This is also why PNG images, even with their maximum compression settings, will still almost always be larger than a JPEG image with even moderate settings - it doesn't discard image details like JPEG does.

The CAPTCHA images you reference, are compressed at a relatively low-quality/high-compression setting, in order to make them as small as possible to preserve your network bandwidth (and storage on the server end). These settings would not generally be used for images intended for print/display/archival/etc.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ JPEG is optimised for throwing away information that human vision cares less about. Using high compression ratios on CAPTCHAs thus tends to cause more damage to machine recognition than human recognition, so it's not just a win in bandwidth but also in "captchaness". \$\endgroup\$
    – user92750
    Commented Jun 29, 2020 at 11:39
  • \$\begingroup\$ Images<>Photos. A screenshot of an application is typically a lot smaller as a PNG (unless of course the app displays a photo...). \$\endgroup\$
    – xenoid
    Commented Jun 29, 2020 at 15:32
  • \$\begingroup\$ One factor in designing compression is to place the artifacts with spatial limitations so that they are not readily resolvable with a normalized viewing (subtended angle). \$\endgroup\$
    – mongo
    Commented Jun 30, 2020 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.