Thursday, 22 August 2013

Basic Image File Formats

Image processing is a broad area. Image is nothing but a combination of pixels. It has various file formats.
      1)     BMP (Bitmap file format)
      2)     JPG (Joint Photographic Expert Group)
      3)     TIF (Tagged Image file format)
      4)     PNG (Portable Network Graphics)
      5)     PPM, PGM, PBM, PNM and PFM
      6)      RAW (Raw Image format)
      7)     GIF (Graphics Interchange Format)

The BMP file format (Windows bitmap) handles graphics files within the Microsoft Windows OS. Typically, BMP files are uncompressed, hence they are large; the advantage is their simplicity and wide acceptance in Windows programs.

JPEG (Joint Photographic Experts Group) is a compression method; JPEG-compressed images are usually stored in the JFIF (JPEG File Interchange Format) file format. JPEG compression is (in most cases) lossy compression. The JPEG/JFIF filename extension is JPG or JPEG. Nearly every digital camera can save images in the JPEG/JFIF format, which supports 8-bit grayscale images and 24-bit color images (8 bits each for red, green, and blue). JPEG applies lossy compression to images, which can result in a significant reduction of the file size. The amount of compression can be specified, and the amount of compression affects the visual quality of the result. When not too great, the compression does not noticeably detract from the image's quality, but JPEG files suffer generational degradation when repeatedly edited and saved. (JPEG also provides lossless image storage, but the lossless version is not widely supported.)

TIF is lossless (including LZW compression option), which is considered the highest quality format for commercial work. The TIF format is not necessarily any "higher quality" per se (the image pixels are what they are), and most formats other than JPG are lossless too. This simply means there are no additional losses or JPG artifacts to degrade and detract from the original. And TIF is the most versatile, except that web pages don't show TIF files. For other purposes however, TIF does most of anything you might want, from 1-bit to 48-bit color, RGB, CMYK, LAB, or Indexed color. Most any of the "special" file types (for example, camera RAW files, fax files, or multipage documents) are based on TIF format, but with unique proprietary data tags - making these incompatible unless expected by their special software.

PNG can replace GIF today (web browsers show both), and PNG also offers many options of TIF too (indexed or RGB, 1 to 48-bits, etc). PNG was invented more recently than the others, designed to bypass possible LZW compression patent issues with GIF, and since it was more modern, it offers other options too (RGB color modes, 16 bits, etc). One additional feature of PNG is transparency for 24 bit RGB images. Normally PNG files are a little smaller than LZW compression in TIF or GIF (all of these use lossless compression, of different types), but PNG is perhaps slightly slower to read or write. That patent situation has gone away now, but PNG remains excellent. Less used than TIF or JPG, but PNG is another good choice for lossless quality work.

Netpbm format is a family including the portable pixmap file format (PPM), the portable graymap file format (PGM) and the portable bitmap file format (PBM). These are either pure ASCII files or raw binary files with an ASCII header that provide very basic functionality and serve as a lowest common denominator for converting pixmap, graymap, or bitmap files between different platforms. Several applications refer to them collectively as PNM or PAM format (Portable Any Map). PFM was invented later in order to carry floating-point-based pixel information (as used in HDR).
RAW refers to raw image formats that are available on some digital cameras, rather than to a specific format. These formats usually use a lossless or nearly lossless compression, and produce file sizes smaller than the TIFF formats.
(Graphics Interchange Format) is limited to an 8-bit palette, or 256 colors. This makes the GIF format suitable for storing graphics with relatively few colors such as simple diagrams, shapes, logos and cartoon style images. The GIF format supports animation and is still widely used to provide image animation effects. It also uses a lossless compression that is more effective when large areas have a single color, and ineffective for detailed images. 

Best Image file Types:

Photographic Images
Graphics, including
Logos or Line art 
Photos are continuous tones, 24-bit color or 8-bit Gray, no text, few lines and edges
Graphics are often solid colors, with few colors, up to 256 colors, with text or lines and sharp edges
For Unquestionable Best Quality
TIF or PNG (lossless compression
and no JPG artifacts)
PNG or TIF (lossless compression,
and no JPG artifacts)
Smallest File Size
JPG with a higher Quality factor can be decent.
TIF LZW or GIF or PNG   (graphics/logos without gradients normally permit indexed color of 2 to 16 colors for smallest file size)
Maximum Compatibility
(PC, Mac, Unix)
Worst Choice
256 color GIF is very limited color, and is a larger file than 24 -bit JPG
JPG compression adds artifacts, smears text and lines and edges

No comments:

Post a Comment