Skip to content

Latest commit

 

History

History
157 lines (87 loc) · 3.68 KB

image-formats.md

File metadata and controls

157 lines (87 loc) · 3.68 KB

Image formats

GIF

Max 8 bit colors.

Lossless compressed.

Obsolete.

Associated with the web: huge browser support.

Can contain multiple images to make very short videos.

To create a GIF from multiple images or vice versa use ImageMagick convert.

License: non-free.

Can have multiple images.

PNG

https://en.wikipedia.org/wiki/Portable_Network_Graphics

Lossless compression, alpha layer, wide software support.

Best format for non-vector lossless.

Interlacing: if yes, the image is streamed in random order with added pixel position information

This is useful for slow data channels like the Internet, so that when the browser loads it, pixels load all over, and not from top to bottom.

This increases the size of the image, since it is then necessary to keep bit position information.

History: created as a replacement for GIF which is not free.

Format license: free?

Implementation: libpng reference. License: own permissive license.

Typical compression ratio: 4:1 - 10:1.

Cannot have multiple images.

APNG

Animated PNG! Works on Firefox. Goodbye GIF.

Sample: http://people.mozilla.org/~dolske/apng/demo.html

JPG

Lossy, good compression/quality loss ratio, wide software support.

Best format for non vector lossy.

Amount to lose can be controlled to increase compression.

Algorithm: removes high frequencies of the image's 2D Fourier transform.

Typical compression ratio: depends on the quality parameters:

  • high quality: 10:1 - 20:1. High quality usage only.
  • medium quality: 30:1 - 50:1. Good for the web.
  • low quality: 60:1 - 100:1. Only usable for thumbnails.

SVG

Vector, XML based, non-compressed.

Standard developed by W3C, so the format is closely linked to the web and browsers. Latest version: http://www.w3.org/TR/SVG/. Can be styled by separate CSS style sheets.

Image is described by mathematical formulas, not bits, therefore it is potentially tiny if the image is mathematically simple and the description is perfect (to floating point precision), which allows for example for infinite zoom.

Cannot however describe photos from real life in general (there are attempts to convert photos to vector, but they are far from usable). it is basically used for images which were generated by the computer without a huge number of lines such as graphs.

Render size may be higher though, but at least over the Internet this is countered by the matters less because bandwidth is a bottleneck.

Reasonable browser support and increasing.

TIF

Has both lossless and lossy versions, in practice lossless applications only.

Exif

https://en.wikipedia.org/wiki/Exchangeable_image_file_format

TODO I think it sets parameters of other formats like JPEG to specific values, and adds mandatory metadata. Does not include PNG and GIF.

Raw formats

https://en.wikipedia.org/wiki/Raw_image_format

YUV

https://en.wikipedia.org/wiki/YUV

Packed format

Planar format

Planar format

Packed:

  • R[1]
  • G[1]
  • B[1]
  • R[2]
  • G[2]
  • B[2]
  • ...

Planar:

  • R[1]
  • R[2]
  • ...
  • G[1]
  • G[2]
  • ...
  • B[1]
  • B[2]
  • ...

Semi-planar: TODO

BMP

Bit by bit, no compression.

Specified by Microsoft.

Macroblock

https://en.wikipedia.org/wiki/Macroblock

Encoding concept present in many formats, including JPEG and H.264.

FLIF

http://flif.info/index.html

TGA

https://en.wikipedia.org/wiki/Truevision_TGA

Old, does not specify a new compression method, but container format allows it.

DDS

https://en.wikipedia.org/wiki/DirectDraw_Surface

Made specifically to store textures for 3D rendering, has hardware decoding support.

Sample OpenGL usage: https://github.com/opengl-tutorials/ogl/tree/71cad106cefef671907ba7791b28b19fa2cc034d/tutorial11_2d_fonts