Iwas recently asked what is the best format to store images in. Unfortunately the answer I give to this question is the same one I give to most of my questions. It depends on what you are doing with it.
Recently I started publishing a list of file extensions, and as you can see from that document there are a huge number of different file formats around. The common considerations used to decide on your format are:
As an example I prefer GIF images over PCX images because you can get anywhere between 30 and 80 percent space saving without loss of image quality.
RASTER VERSUS VECTOR IMAGES
There are two kinds of images in use on computers - vector and raster. Raster images, used with paint programs, are composed of pixels, and each pixel has qualities (such as color) associated with it. The bigger the image, the more pixels it has, and the larger the file size. Vector images are not composed of pixels. These images include instructions used to reconstruct the objects that make up the complete image. For example, a circle might be described in terms of its center, radius, colour, shading, and the line weight used to draw it.
Both Types of image file has its uses. The primary difference between them has to do with pixels. If you try to enlarge an image made of pixels (raster images), you just turn the pixels into larger blocks. This enlarges rough edges, and at large sizes, the jagged edges are obvious. A vector image, on the other hand, does not use pixels; you can enlarge the image to any size you need and still get smooth line. By reducing a raster image the quality of the picture is compromised (Data is lost) while a Vector image can be scaled down without any quality loss (unless scaling is done to an extreme).
Trying to convert a photograph to a vector image would be an exercise in stupidity. You should use Raster images for photographic or freehand graphics and Vector graphics for Drawings and diagrams. If you are designing a logo, a vector format works better because you can scale the image to any size without the problems inherent with pixels. You can use a small version of the logo on letterhead, and a large version as the heading on a poster. If you plan to combine raster and vector images, you can either use a program that accepts both as imports or use a format that can incorporate both kinds of images such as EPS or CGM files.
High-resolution images use large amounts of memory and hard disk space. For example, a full color image of a single A4 page can occupy more than 2OM!
Although huge hard disks to store this kind of data are more common, most users need some form of compression to make practical use of high-resolution images.
There are two different kinds of compression available. One method looks for repeating patterns in the source file. Instead of storing all the source data, it stores the patterns plus instructions for combining them to re-create the original file. Using this technique, the restored file is identical to the source file. eg (Gif, Tif) The other kind of compression is called lossy compression (not lousy!). As the name implies, some data is lost during compression. Instead of looking for repeating patterns, lossy compression methods perform sophisticated mathematical analysis on the source data. These methods vary, but they are all complicated, full of references to cosines, DCT (discrete cosine transform), forward DCTs, Q-factors, and quantization matrices.
The better the image, the more data you have to deal with, and the amount of data grows rapidly as image quality increases. It is not unusual to see file sizes of 24M for large, 24-bit color images. Even the best compression techniques begin to falter with this much data. There are many ways to store image data. The most common method used on PCs involves RGB-the proportions of red, green, and Blue that make up the image. Looking at an image as a combination of red, green, and blue is not efficient. However, there are other ways of looking at color. For example, you can separate a color into its hue, saturation, and brightness. Any such description is a mathematical model for a color, and each model has advantages and disadvantages. One of the most efficent and well known methods is the Fractal method. There are very few programs which support this standard (Fractal Painter, ...) because it is a patented algorithm and royalties are required for each program sold which incorportates the logic.
Lossy compression techniques do have one salvation: many offer a way to control the amount of loss. You can specify a factor that controls how severely the compression affects picture quality. If you can accept some image degradation, compression ratios of 40:1 or more are possible.
The most commonly supported lossy compression method is called the Joint Photographic Experts Group (JPEG). In addition to converting from RGB to make compression simpler, JPEG arranges the colors in the image to determine which are more commonly used. By specifying a Q factor, you can determine how many of the less frequently used colors are dropped (converted to more commonly used colors). This gives you some control over the degree of image loss involved in the compression. This explanation is over- simplified, but it gives you some idea how lossy compression can be varied. JPEG breaks the image down into small blocks and compresses each block before moving on to the next. This allows for compression-on-the-fly, but it introduces some problems too. Block boundaries can become over-emphasized, distorting an image at high compression ratios. JPEG also has a harder time handling colors that involve high frequencies (blue). This means that bluish colors have fewer variations. Because this limitation matches the eye's reduced capability to distinguish blue color variations, this isn't usually a problem. It should be noted that JPEG is a standard for Compressing image data but that doesn’t describe how I should store the compressed data, JFIF (JIF) is a standard for how JPEG compressed data should be stored.
Lossy compression has tremendous advantages when compared to conventional compression techniques. If nothing else, the ability to reach compression ratios of 10:1, 20:1, and beyond without seriously distorting an image dramatically overshadows the paltry 2:1 and 3:1 compression ratios used on text files. Because lossy compression involves sophisticated data handling, it takes time to perform the calculations. Several manufacturers offer hardware that has built-in image compression, but its use is limited to special situations. The benefits of hardware compression are significant-as much as 20 times faster than software compression. However, unless hardware compression/decompression becomes part of most PCs, software has to do the job.
Lossy compression has its problems. Compressing a restored file a second time (for example, after additional editing) results in further loss of data, and additional image degradation. Certain applications, such as medical imaging, cannot tolerate any loss at all.
There are many ways to store image data. The most common method used on PCs involves RGB-the proportions of red, green, and Blue that make up the image. Using in 8 bits (1byte) to store the color information enables you to store as many as 256 colors for each pixel. Using fewer than 256 colors results in a low-quality image. Expanding the number of bits to 16 or 24 gives you 32,768 or 16.7 million colors, respectively. These images are much more photo-realistic, particularly at higher resolutions.
|Bits per Pixel||Maximum colours per pixel|
|1||2 (Black & White)|
Different image file formats are capable of holding different quantities of colors. Each file format will have a reference to the number of bits-per-pixel that the format is capable of supporting.
I was once told by an “image expert” in our club that colour is more important than resolution. A true colour low res image is easier for people to interpret than a black & white high resolution image.
There is no advantage at storing an A4 raster image at 300 DPI if you wish to display it only on a video screen. The viewer will be required to throw away data to shrink the image and will result in doubtful results. It is better to scan the image at 75 dpi in the first instance. Likewise scanning an image at 75 dpi to print on a 400dpi printer will give dreadful results.
RECOMMENDED IMAGE FORMATS TO EVALUATE FOR YOUR NEEDS:
JFIF, GIF, PCX, TIFF, MPEG
BMP-OS/2-RGB - Bits-per-pixel 1, 4, 8, 24.
BMP-Windows-RGB - Bits-per-pixel: 1, 4, 8, 24.
BMP-Windows-RLE - Bits-per-pixel 4, 8.
DIB-OS/2-RGB - Bits-per-pixel: 1, 4, 8, 24.
DIB-Windows-RGB - Bits-per-pixel: 1, 4, 8, 24.
DIB-Windows-RLE - Bits-per-pixel: 4, 8.
CLP - Bitmap and DIB - Bits-per- pixel: 1, 4, 8, 24.
CUT - Bits-per-pixel: 8.
EPS - Bits-per-pixel 1, 4, 8, 24.
Both versions may use an encoding method referred to as interlacing. When an image is saved by using four passes instead of just one, it is called interlacing. On each pass, certain lines of the image are saved to the file. If the program decoding a GIF file displays the image as it is decoded, the user will be able to see the four passes of the decoding cycle. This will allow the user to get a good idea of what the image will look like before even half of the image is decoded.
Some communication programs allow the user to download GIF files and view them as they are downloaded. If the image is interlaced, the user will be able to decide if the image is one they like before half of the download is complete. If the user does not like the image, the download can be aborted. This results in the saving of time and money for the person downloading the image. Both versions 87a and 89a may be interlaced and may contain more than one image
All the GIF formats support bits-per-pixel: 1, 4, 8.
IFF - Bits-per-pixel 1, 4, 8.
IFF - Bits-per-pixel: 1, 4, 8.
The IMG-Old Style - Bits-per-pixel: 1, 4, 8.
The IMG-New Style - Bits-per-pixel: 1, 4, 8.
(Images that are more than 1 bit-per- pixel are greyscaled images.)
JAS - Bits-per-pixel: 8, 24
JIF/JPG - Bits-per-pixel 8, 24
LBM - Bits-per-pixel: 1, 4, 8.
MAC- No header - Bits-per-pixel: 1.
MAC- Header - Bits-per-pixel: 1.
MSP-Old Version - Bits-per-pixel: 1.
MSP-New Version - Bits-per-pixel: 1.
PCD - Bits-per-pixel: 8, 24.
PCX Version 0 - Bits-per-pixel: 1.
PCX Version 2 - Bits-per-pixel: 1, 4.
PCX Version 3 - Bits-per-pixel: 1, 4.
PCX Version 5 - Bits-per-pixel: 1, 4, 8, 24.
PIC - Bits-per-pixel: 1, 4, 8.
RAS-Type I-Modem Style - Bits-per- pixel:1, 8, 24, 32.
RLE - CompuServe - Bits-per-pixel: 1.
RLE - Windows - Bits-per-pixel: 4, 8.
TGA - No Compression - Bits-per- pixel: 8, 16, 24, 32.
TGA - Compressed - Bits-per-pixel: 8, 16, 24, 32.
TIFF-No Compression - Bits-per-pixel: 1, 4,8,24.
TIFF-Huffman - Bits-per-pixel: 1.
TIFF-Pack Bits - Bits-per-pixel: 1, 4,8,24.
TIFF-LZW - Bits-per-pixel: 1, 4,8,24.
TIFF-Fax Group 3 - Bits-per-pixel: 1.
TIFF-Fax Group 4 - Bits-per-pixel: 1.
WMF - Bits-per-pixel: 1, 4, 8, 24.
WPG Version 5.0 - Bits-per-pixel: 1, 4, 8
WPG Version 5.1 - Bits-per-pixel: 1, 4, 8