Image Compression vs. Image Quality: Finding the Best Tradeoff
|Time Required||Short (2-5 days)|
|Prerequisites||Good computer skills; Project costs lower depending on printing method and number of images printed.|
|Material Availability||Readily available|
|Cost||Very Low (under $20)|
AbstractIn this project you'll learn about how digital image files are encoded, and how digital images can be compressed so that the files take up less storage space and can be transmitted more quickly. You will also measure the quality of compressed and uncompressed images, which will give you important insights into the tradeoffs between file size and image quality.
ObjectiveThe objective of this project is to compare at least two different image compression algorithms and rate them for:
- image quality, e.g.:
- subjective quality ranking (1-10 scale after careful comparison),
- resolution (what is the size of the smallest detail you can distinguish in the image?), or
- come up with your own quality measure.
- compression ratio (size of original image file/size of compressed image file)
Cite This PageGeneral citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.
Last edit date: 2017-07-28
What's so important about image compression algorithms? With today's computers, DVDs and digital cameras, digital images are everywhere. For example, on websites images are used for advertising, and as illustrations and diagrams for articles. Image files can easily be huge (more on this later). Image compression is essential for DVDs and speedy downloading of webpages over a network connection.
What makes image files so big? Digital images such as photographs are generally encoded as rows and columns of pixels (from picture elements). This type of image format is called a raster image. The more pixels in each row and column, the better the resolution of the image. For example, an image that is 1280 pixels wide by 1024 pixels has better resolution than an image that is 640 pixels wide by 512 pixels tall. It will appear smoother, less "pixellated". But the higher resolution comes at the cost of four times as many pixels. In addition to spatial resolution, there is also the problem of color encoding. An image with 24 bits of color information for each pixel will generally look better than an image with only 16 bits of color information for each pixel. Again, the better the color resolution, the bigger the image file.
In order to make the most efficient use of images, it is important to match the spatial and color resolution of the image to the spatial and color resolution of the intended output device. For example, a typical computer screen has a spatial resolution of about 75 pixels per inch (also referred to as dots per inch or "dpi"), and color resolution of 24 bits per pixel. Printers, on the other hand, have much higher spatial resolution, anywhere from 300 dpi to as much as 9600 dpi horizontally by 2400 dpi vertically. Obviously, a high-quality printed image is going to be a lot bigger than the same size image displayed on a computer screen.
Image compression algorithms are designed to minimize image file size in order to speed up image data transmission. There are "lossless" algorithms, which have the property that all of the original information in the image can be recreated from the compressed image, and there are "lossy" algorithms, which sacrifice some of the original image information in order to compress the image further.
How much can an image be compressed with a "lossy" algorithm before you start to notice a difference in image quality? Do some types of images lose image quality more quickly than others? This project will help you to answer these questions, and more.
Terms and ConceptsTo do an experiment in image compression, you should do research that enables you to understand the following terms and concepts:
- image file formats: JPG (also known as JPEG), GIF, PNG, TIFF
- lossless compression vs. lossy compression,
- printer resolution vs. screen resolution,
- 8-bit vs. 16-bit vs. 24-bit color.
- What are the advantages of lossy image compression over lossless image compression?
- What are the advantages of lossless image compression over lossy image compression?
- Does JPEG image compression work equally well with all types of images? (For example, consider color vs. grayscale images, or line drawings vs. continuous-tone images, or natural landscape vs. manmade cityscape images, etc.)
- If not, what types of images compress "better"?
- What types of images compress "worse"?
- How about other compression algorithms?
- What should you look for when assessing image quality?
- digital image basics (including a gallery of sample test images):
- download Irfan view: http://www.irfanview.com/main_download_engl.htm
- JPEG compression:
- PNG compression:
News Feed on This Topic
Materials and Equipment
- computer (with Internet connection),
- image writing software (e.g., Irfan view),
- digital image files:
- use your own digital camera (optional, but helpful), or
- download images from the Web (see Bibliography for one possible source)
- printer, for comparing images,
- an assistant to secretly label the print-outs, so you can rate the images "blind".
Image Compression vs. Image Quality: Finding the Best Tradeoff
- Do your background research, and test your knowledge by explaining the terms and concepts, and answering the questions in the section above.
- Select a set of images for your experiment.
- From your background research, you should be able to form a hypothesis about which types of images will work best with each compression algorithm you test. Try to select images for both best- and worst-case for each algorithm.
- If you take your own digital photographs, you will not have to worry about copyright issues.
- If you download images from the Web, make sure that you have permission to use the image from the copyright holder (if any).
- Learn how to use your image-writing program to save images in compressed format.
- Read about the different options in your program's help file.
- Select "low", "medium" and "high" image quality compression settings for each algorithm you are using.
- Use your image-writing program to save each image with the "low", "medium", and "high" image quality settings you selected for each compression algorithm. Name each file so that you can tell which settings and algorithm were used to create it, and which original image it came from.
- Have your assistant help you to print the images, labeling them on the back with a coded name. Your assistant should be able to match the coded names to the original ones, but you should not know the code. All of the images should be printed with the same paper type, printer and printer settings.
- Study the images, and arrange them in order of image quality from best to worst. Then assign a "quality score" to the images, for example, on a scale of 1-10. If two or more images appear indistinguishable, rank them equally. Take notes on what features you used to rank the images as you did. (This is called a "blind" test, because you do not know which algorithm and settings produced which image.)
- After all of the images have been rated, have your assistant reveal the codes. Now you can add the compression information to your ratings, and make comparisons.
- Compare the trade-offs in file size vs. image quality for different image types. For example, you might want to make a graph of compression ratio vs. your image quality ranking. Can you draw any conclusions about when image compression is worthwhile and when it is not? Or how much compression is acceptable for a particular purpose (say, sending a photo album of your summer vacation to your cousin by email).
Keep the fun going! Find local opportunities related to this project.Register on ActivityHero
If you like this project, you might enjoy exploring these related careers:
- Use a resolution target as one of your test images. For example, here is a US Air Force bar target. The bars are arranged in groups of six (three horizontal and three vertical) at progressively smaller sizes. Make a set of images with "low", "medium" and "high" compression settings. Print the images exactly the same way (same size, printer resolution, paper, etc.) Study the image print-outs with a magnifying glass to see the smallest set of features you can distinguish, and compare this to the compression ratio. Click to download high-resolution image:
- If you print out your images at "thumbnail" size, is a higher compression ratio more or less noticeable than when the image is printed at normal size? Why? How does this compare to images intended for viewing on the computer screen vs. images intended for printing?
- "zip" files: another common file compression method is the "zip" file, a lossless compression method. Can compressed image files be further compressed by "zipping" them?
Ask an ExpertThe Ask an Expert Forum is intended to be a place where students can go to find answers to science questions that they have been unable to find using other resources. If you have specific questions about your science fair project or science fair, our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.
Ask an Expert
News Feed on This Topic
Looking for more science fun?
Try one of our science activities for quick, anytime science explorations. The perfect thing to liven up a rainy day, school vacation, or moment of boredom.Find an Activity
Explore Our Science Videos
How to Make an Electromagnet
How to make an anemometer (wind speed meter)
10 Robotics Projects Kids Can Really Make!