Image file formats
Some commonly used file formats
TIFF ( Tagged Image File Format)
• Usually Images are larger in size and of high quality.
• Can have multiple extensions based on applications. But hence not
portable.
• May or maynot be compressed.
• Algorithms that can be used to compress TIFF images :
- Huffman coding
- LZW compression
• Not suitable for web
TIFF continued..
• It is organized in 3 sections :
• Image File Header (IFH)* - first 8 bytes of image file
• Image File Directory (IFD)*
TIFF subfiles
• Bitmap data
• IFD contains multiple 12-byte records called ‘tags’. There are 70 tags
defined in as public tags. User defined tags are called private tags.
• There are three possible ways
to arrange data in TIFF
TIFF continued..
• Header contains information about byte order, version information
and a position at which first IFD starts. ( word, word, double word)
• Each IFD contains information about height and width of an image
depth of each pixel and type of data encoding used. Some file tags are
: Artist, Uncompressed, ImageHeight, Copyright.
• Bitmap data may not be continuous. Hence simple applications may
not be able to read TIFF files.
BMP
• Simple – Highly standardized and widespread.
• Does not offer significant image compression.
• Simple editor can support BMP images due to its simplicity.
• Hence widely used.
• BMP section is broken into 4 main sections –
• File header
• Image header
• Color table
• Pixel data
BMP continued ..
• The file header (14 bytes) contains information about file size and
location at which data is stored.
• The Image header (40 bytes*) tells information about rows and
columns of an image, bits per pixel, type of compression used if any.
• The color table& provides color palette
• Pixel data is written in bottom to top fashion. Row starts with double
word boundaries.
• Each row is written left to right.
PNG (Portable Network Graphics)
• PNG file consists of PNG signature followed by series of chunks.
• Chunk contains –
• Length ( 4byte unsigned integer)
• Chunk type (4byte chunk type code) - Image header, image data etc.
• Chunk data – data type appropriate for chunk type. Field can be of zero
length.
• Cyclic Redundancy Check (CRC) (4 byte)
PNG continued ..
• First 8 bytes identify PNG image :
137 80 78 71 13 10 26 10
• Length : 4 byte unsigned int. does not include itself, type code and
CRC.
• Chunk type : chunk type identifies the type of data in data field.
• Chunk Data : The data appropriate to chunk type. Can be of 0 length.
• CRC : calculated on previous data. Does not include length field.
HEIF (High Efficiency Image Compression)
• Being used by apple to replace JPEG.
• It is a format for image sequences as well as for individual images.
• still images encoded with the HVEC (H.265) video format.
• Works well with live photos
• “MPEG group claims that twice as much information can be stored in
a HEIF style image as a JPEG one of the same size.”
• HEIF supports 16 bit color as oppose to 8-bit color used by JPEG
HEIF continued ..
• Container and codec are separate.
• Every element in HEIF file is called an ‘item’.
• Structures link one item to other.
• Items identify various properties in the file format.
HEIF continued ..
HEIF continued .. (JPEG vs HEIF)
• Block size :
• 8x8 block size for jpeg 8 to 16 for HEIF. It is flexible.
• Can predict all values within a block using data from other blocks.
• CABAC coding is used instead of Huffman coding.
• JPEG uses global quantization matrix. HEVC uses separate
quantization parameters. This gives flexibility of local quantization.
• Deblocking filter to smoothen the transition. SAO follows.
References
• What is TIFF file format. https://kb.iu.edu/d/afjn
• Bitmap image file format
http://www.dragonwins.com/domains/getteched/bmp/bmpfileformat.htm
• Gif image file format https://www.fileformat.info/format/gif/egff.htm
• File format info https://www.fileformat.info
• Simplified windows file format
http://www.dragonwins.com/domains/getteched/bmp/bmpfileformat.htm
• PNG specification version1.2
http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html
• Apple wwdc talk
https://developer.apple.com/videos/play/wwdc2017/513/