Image file formats
Mini-course at ICERM
Arnaud Chéritat
Page *
Raw vs Compressed
There are two kind of bitmap images
Raw images are not common. Sometimes used in photography. Popular ones include(d) BMP, TIFF, RAW. Note that in fact, BMP and TIFF have compression options in their specifications.
Raw images are heavy:
About units of digital file size:
- B = byte = 8 bits
- kB = kilobyte = 1000 B
- MB = megabyte = 1000 kB
- GB = gigabyte = 1000 MB
- ...
- Kio = kibibyte = 1024 B = 210 bytes
- Mio = mebibyte = 1024 KiB
- Gio = gibibyte = 1024 GiB
- ...
Mid 2010s: In full HD (1920×1080 pixels), standard color (3 octets par pixels), weights
6 220 800 bytes ≈ 6 MB.
The typical RAM memory of a modern PC is 8GB, so that is a ratio of about 1 to 1300.
Mid 1980s: The inital model of the personnal computer Atari ST had a screen resolution of 320×200 pixels in 16 colours. For 16 colours one needs 4 bits = 1/2 a byte. Hence the raw image used
320×200÷2 = 32 000 bytes = 32 kB.
The machine's RAM was 512KiB~524kB. Ratio: about 1 to 16.
2020's: 8K UHD 7680×4320 = 33 177 600 pixels. If 12 bits per channel one gets
7680×4320×4.5 = 149 299 200 bytes ≈ 150 MB.
There are two kind of compressions
Examples:- PNG: lossless, DEFLATE algorithm
- GIF: lossless, Lempel-Ziv-Welch algorithm
- JPEG: uses Fourier transforms and only keeps most significant waves.
Compression rates
Bird
The image is 607×471 pixels. High quality photograph with very little noise.
Format | Weight | comp. rate |
---|---|---|
Raw | 858 kB | 1 |
PNG | 608 kB | 1.4 |
GIF, dithering (lossy!) | 183 kB | 4.7 |
JPEG, max quality (100%) | 393 kB | 2.2 |
JPEG, high quality (78%) | 53 kB | 16 |
A 4200x4200 pixels image with an 11 colors palette and big areas of uniform colors.
Format | Weight | comp. rate |
---|---|---|
RAW paletted | 18 MB | 1 |
RAW true color | 36 MB | 0.33 |
PNG | 500 kB | 36 |
GIF | 632 kB | 27 |
JPEG 100% | 8.2 MB | 2.2 |
JPEG 78% | 2.7 MB | 6.5 |