Image Formats

From GDWiki

Jump to: navigation, search

Different image formats have different strong and weak points; it is important to be aware of these in order to chose the right format for the task at hand.

Contents

[edit] Raster Formats

[edit] General Information

The below table exists to compare various common raster image formats. Please note that not all image formats are present in this table.

RGB RGBA Grayscale Indexed HDR Animation Compression Free Extensible
BMP 24-bit No 8-bit Yes No No lossless (RLE) Yes No
DDS 24-bit 32-bit No No No No lossy (S3TC/DXTn) No [1] No
GIF No No 8-bit Yes No Yes lossless (RLE) Yes [2] No
JPEG 24-bit No No No No No [3] lossy (DCT) Yes [4] No
JPEG 2000 24-bit, 48-bit 32-bit, 64-bit? 8-bit, 16-bit No No No various No [5]  ?
PCX No No 8-bit Yes No No lossless (RLE) Yes? No
PNG 24-bit, 48-bit 32-bit, 64-bit 8-bit, 16-bit Yes No No [6] lossless (deflate) Yes Yes
TGA 24-bit 32-bit Yes Yes No No lossless (RLE) [7] Yes No
TIFF 24-bit+ 32-bit+ Yes Yes Yes No various Yes? Yes
  1. There are current patents on the S3TC compression techniques; as such, it is illegal to implement S3TC/DXTn compression without a license. Keep in mind, however, that video card vendors have already obtained this license to decompress S3TC/DXTn in hardware; so long as you do not compress/decompress in your own code, you do not need a license.
  2. Originally, the compression used by GIF was patented by Unisys, preventing free use. Since August, 2004, however, all relevant patents have exipred (see Unisys and LZW patent enforcement on Wikipedia.)
  3. There is a related format called "Motion JPEG" used for video files; however, this is not directly part of the JPEG format itself.
  4. There have been various patents asserted over JPEG in its lifetime, although all known patents have either expired or been ruled invalid. That said, as a widely used, popular image format, there may yet be submarine patents that have not yet come to light.
  5. Whilst the core parts of JPEG 2000 are stated to be freely implementable, many advanced features require licensing fees to implement.
  6. There are two standards which provide an animated PNG-style format: MNG and APNG. MNG is a relatively large, complex standard that has not seen wide adoption but is championed by the creators of PNG. APNG is a simple modification to the standard PNG format to support multiple frames, and has found support from several web browser vendors.
  7. TGA optionally supports RLE compression, although it is commonly used without compression at all.
Explanation of columns
RGB 
format support for direct RGB color, and in what bit-depth(s).
RGBA 
format support for direct RGBA color, or RGB plus an alpha mask, and in what bit-depth(s).
Grayscale 
format support for grayscale images, and in what bit-depth(s).
Indexed 
does the format support 8-bit indexed (or paletted) images.
HDR 
can the format store High Dynamic Range (a.k.a. floating-point) image data?
Animation 
does the format support sequenced frame animation or better?
Compression 
what, if any, compression method(s) does the format use?
Free 
is the format free of patents and/or licensing fees?
Extensible 
can additional information be attached to images whilst retaining compatibility with existing tools?

[edit] BMP

Pros:

  • Widely supported.

Cons:

  • Produces large files.
  • Does not support alpha transparency.

[edit] DDS

Pros:

  • Native format for S3TC/DXTn compression—compressed image data can be uploaded directly to video card memory.
  • Supports other features like cube maps, mip maps, etc.

Cons:

  • Compression format is patented, requiring a license to compress or decompress outside of hardware.
  • No support for lossless compression.

[edit] GIF

Pros:

  • Supports animation.

Cons:

  • Very low visual quality.
  • For still images of identical quality, PNG is always smaller.

[edit] JPEG

Pros:

  • Good lossy compression.
  • Widely supported and implemented—there are a number of freely available libraries for it.

Cons:

  • Can produce noticeable compression artifacts.
  • Is not natively supported by video cards.
  • No support for lossless compression.

[edit] JPEG 2000

Pros:

  • Very advanced format.
  • High color depth.
  • Advanced lossy compression (wavelets).
  • Lossless compression.

Cons:

  • Not as widely supported as JPEG yet.
  • Patent concerns exist.

[edit] PCX

Pros:

  • Old, fairly established format.

Cons:

  • Support for it is waning.
  • Limited color depth.

[edit] PNG

Pros:

  • Well documented, standardised format.
  • Widely supported and implemented—reference implementation freely available.
  • Supports very high depth images (48-bit RGB, 64-bit RGBA and 16-bit grayscale).
  • One of the best-performing lossless formats.

Cons:

  • No support for floating-point images.
  • No support for lossy compression.

[edit] TGA

Pros:

  • Incredibly simple format for uncompressed images.
  • Widely supported and implemented.

Cons:

  • Somewhat archaic and difficult to implement for other-than uncompressed RGB/RGBA images.

[edit] TIFF

Pros:

  • Very flexible, supports a wide variety of image formats both lossy and lossless.
  • Supports very high color depth.

Cons:

  • Very difficult to implement.
  • Has a huge number of features that might potentially need to be supported.

[edit] Vector Formats

This article is a stub. You can help out by expanding it.


[edit] General Information

Color space Encoding Embed Bitmaps? Animation Compression Free Extensible
SVG RGB, RGBA, HSL, CMYK Yes Yes Yes Yes Yes Yes
Categories