JPEG - GIF Conversions

Objective

To examine how repeated file format conversion affects the quality of an image.

Difficulty

Procedure: Easy

Concept: Medium

Concept

Storing a photograph on a computer can take a lot of memory. This is the reason why image formats like GIF and JPEG were invented. These formats try to keep what is most important about an image and not worry about the rest. Usually the change would not be this drastic, but for the sake of clarity observe the two images below.

Image File Compression

This is the type of thing a compression algorithm for images might do, it would lose some of the details of the picture but in exchange it would make it a much smaller file.

But what if we repeatedly apply such a procedure to a picture, by converting it between two different compression formats? Will the programs only throw away the extra information once, and thereafter the image will remain the same no matter how many times it is converted? Or will the programs keep throwing away more and more information? In that case, do we at least keep getting a smaller and smaller file size?

Hypothesis

Will repeated fill format conversion continue to degrade image quality? Will the file size shrink?

Materials

Procedure

  1. Open up a photograph you like in ImageMagick, and duplicate the original in a new folder named OUTPUT.
  2. Using ImageMagick, save the photograph as a GIF and call it 1.gif - place it in the same folder.
  3. Now open the newly-created 1.gif file and save it as 2.jpeg (as a JPEG-formatted image, of course) in the same folder.
  4. Continue this process, always alternating between the two file formats and increasing the number in the file name.

Analysis

What happens to the image quality as you continue the above process? Does the file size change?

Extensions

You could try this with different images. Photographs will respond differently then simple cartoons. Try to research how the jpeg and gif formats work and why different types of images might respond differently. Test your theory. ImageMagick can also be operated from a command line. Can you write a simple program that will automate the conversion process for you? (This is usually referred to as a "batch routine" or "batch job.")