understanding image file formats


Learn to make art at home with my art lesson ebook.
  bio   galleries

Basics of image file formats

If you enjoy my free writings, please consider my $19.95 art how-to ebook, Art Head Start, for novice and intermediate artists.


 

 

Image file introduction

High quality images often require millions of pixels, so they make for large file sizes. Larger files take longer to transmit, especially over the Internet. Thus larger image files can cause unacceptable delays before images appear in web pages. Various file formats have been devised to help with this problem, usually by “compressing” the file to remove redundant pixels.

What your image pixels look like in practice is controlled by your operating system, display hardware and software and by the image file format you choose. Because of these things, popular file formats for storing images have differences that affect the look of your work.

Understanding image file formats

Practically speaking, there are the “Lossless” formats, which produce large file sizes and don't affect your image’s quality. Use these to store original images without compromising quality - so you always have a best quality image for future editing. Such files are too large to view over the Internet conveniently and take up lots of space on your storage media. However, hard drive storage is inexpensive these days, so no problem there.

Then there are “Lossy” file types which compress your image files down to more practical sizes for speedier transmission. These formats cause more or less visible (and always irreversible) damage to your images - and compromise any future image editing you might want to do.

You can identify the image file type in use by the filename “extension” - the 3 or 4 character designation after the period, like “my_cool_pix.bmp” for a BMP image.

Popular image file formats

Name Color Type Loss? Transparent? Bit Size Notes
BMP RGB Color No Separate Alpha 1,4,8,16,24 Windows native, seldom compressed
GIF Index Color Yes Yes 8 Variable color, dither, simple animation
JPEG RGB Color Yes No 24 Variable compression, “Progressive”
PNG Index Color Yes Yes 1 to 64 Good transparency at 24 bits
PSD Various No Yes 8,16 Adobe Photoshop™ native, layers
TIFF RGB Color No Yes 8,16,32 Many features, IBM/Mac versions
RAW Digital Sensor No No 36 Digital camera data direct from sensor

*Technically, GIF and PNG use “Lossless” compression. In practice, they can degrade images.

See the Wikipedia main link, or the links for each format “Name” above, for details.

The “Bit Depth” of an image is the number of unique combinations available in the binary number sequence used to store it. For example, a 1 bit image (21) can have only black and white, represented by either a 0 or a 1. The 8 bit formats store 256 or (28) colors – not enough to display continuous tones. 24 bit formats (224) store 16.77 Million colors, more colors than your eye can discriminate. It’s typically used with blends of 8 bit each for the 3 Red/Green/Blue additive primary colors. 32 bit formats use these same 3 RGB 8 bit colors, plus one 8 bit channel for 256 levels of transparency, called the “Alpha Channel”.

The formats I marked as “RGB” allow the display of 24 bit continuous tone images, like photos. However, they are not so good at reproducing hard edges. Index color formats work from a limited palette (set of colors), but render hard edges better. They are most suitable for non-continuous tone logos, text, cartoons, line drawings, maps, etc. - where distinct image areas have just one color each.

Suggestions for image format use

  • Save your original work in a PSD or TIFF format, so it is not degraded, can be edited later and can be used on a Windows or Mac PC.
  • Use these lossless formats to import high quality images, for example to import a grayscale height map into a 3D program to create the elevations of a 3D terrain. Use PSD or TIFF to send someone an original, high quality image.
  • When you must have small file sizes, to submit to an online gallery or have your audience access from a Web server, you need GIF, JPEG or PNG. You will typically be dealing with continuous tone images. JPEG will usually compress these the most, and with the least damage, but does not support transparency. PNG is a better choice for transparency.
  • Be sure to save your original images in a lossless file format before making your lossy compressed versions. And always do compression as your last step, so your editing changes are never applied to an inferior compressed version of your work.

Image file format - examples

95% compressed, severe artifacts

50% compressed, best choice

5% compressed, file too large

32 Colors, bad sky banding

256 colors, slight sky banding

The tests above show that GIF is not a good file format for continuous tone images. Even the largest GIF palette of 256 colors doesn’t give a smooth sky, and it makes a larger file than a well chosen JPEG compression amount does.

A JPEG compression of 55% or even 60% might have been good enough, resulting in an even smaller file size than that of my 2nd example. On the other hand, you’ll see that the GIF format does a better job on hard edges, like the black and white checks and the text. GIF is good for non-continuous tone images.

Always do compression by eye and carefully, rather than using default settings.

I don’t show the original test image above. It looks identical to the 2nd test from the left, as it should. Not degrading your original is the whole idea here.

These tests were made in Adobe Photoshop™, where their excellent JPEG compression is shown as a “quality” percent which is the reciprocal of the compression percent. So the first image shows a “quality” of 5% from a 95% compression.

RAW image format

The RAW image format is a special one available in some digital cameras. Most digital camera settings process and compress your images inside your camera, saving space in your camera’s memory to give you more shots. But this lowers image quality. The RAW format saves the data directly from the camera’s light sensor, with a minimum of processing. Of course RAW files are much larger. You process a RAW formatted image in your computer, where you have more control over image quality. There are no standard RAW formats. Each digital camera has a custom RAW format matching its design, which you must install in your computer.

~ End ~


 

Wishing you a creative future!
   _jim coe
Fine Art Prints on Demand