PNG vs JPEG

by John on January 8, 2009

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.

{ 2 comments… read them below or add one }

1

Noah 06.23.09 at 15:16

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

Mike 01.15.10 at 00:26

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.

Leave a Comment

You can 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>