PNG vs JPEG

Bill the Lizard answered an image compression question on StackOverflow by pointing out the image below that shows the difference between PNG and JPEG compression when applied to line drawings.

The image comes from lbrandy.com. The left side of the image uses PNG compression, a lossless compression format. The right side uses JPEG, a lossy format that computes a Fourier transform and discards the highest frequency components. JPEG can produce smaller files for natural photographic images. But for line drawings, the artifacts of the JPEG compression are noticeable.

3 thoughts on “PNG vs JPEG

  1. I understand what you are saying but you are not comparing apples to apples here and I think that can be a little misleading.

    You can still use JPG and have good looking quality images by not turning the compression up so high: See this example JPG file

    In this case, the stick figure image file is actually smaller using PNG but in certain cases such as photos the JPG file will actually be smaller. I respect the PNG file’s ability to do transparency in most browsers but still thing JPG files have their place. For example, I noticed your photo of the ship Endeavour is a JPG file instead of a PNG file.

  2. More specifically, I believe that JPEG uses the discrete cosine transform, which is similar to but different from just using a discrete Fourier transform.

    Also, JPEG-2000 uses the wavelet transform, which is fundamentally different than a Fourier-related technique.

  3. For those looking for more information, download the source for libjpeg and read the notes.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>