Image File formats
Download some sample images:
- http://www.usna.edu/Users/cs/blenk/si460/Images/bill.bmp
- http://www.usna.edu/Users/cs/blenk/si460/Images/bill.jpg
- http://www.usna.edu/Users/cs/blenk/si460/Images/bill.png
Python Imaging Library (PIL)
- A collection of APIs for Python to interact with images
- Tutorial here
- We use use this in upcoming labs
Important raster file formats:
- bmp
- Stores the color value of each bit separately
- Excellent (lossless) image quality
- Large file sizes
- jpg
- Good controls for trading off image quality versus size - degree of compression can be adjusted
- 'Lossy' compression means that the original image cannot be fully recovered - information is lost
- Most commonly used for cameras and transmitted web images
- Compression works by removing changes in color that the eye is likely to ignore
- Best on images of realistic scenes with smooth color transitions
- Compressed images are smallest when color does not change perceptibly, e.g. a blue sky in the background
- Poor quality on thin lines and icons
- png
- 'Lossless' data compression == small size, excellent quality
- Most popular lossless compression format on the www
- Palette-based, grayscale, full-color non-palette-based
- 1-64 bit color
- Compression is similiar to ZIP files
- The above formats have the following in common:
- Specified resolution, height, and width
- Multiple color depth levels
- BMP and PNG support RGBA (RGB plus Alpha channel), JPG does not
Here is the image above at different JPG 'Quality' levels. Low Quality== more compression.
| "Quality" | Size | Image |
|---|---|---|
| JPG 0% | 10kb | ![]() |
| JPG 10% | 19kb | ![]() |
| JPG 25% | 31kb | ![]() |
| JPG 50% | 45kb | ![]() |
| JPG 85% | 76kb | ![]() |
| PNG | 68kb | ![]() |
| BMP | 272kb | ![]() |






