Which Graphics File Format?
It can at times be a challenge to determine which image format to use.
Graphics Interchange Format is probably the most widely used image format used on the web for graphics. In general, the GIF format is the most suitable type of file for displaying images that are not photographs.
Joint Photographic Experts Group was designed for compressing full-color or gray scale digital images of natural real-world scenes. JPEG is most suitable for images with lots of subtle color variations, such as a photograph, but not so suitable for graphics with areas of the continuous color.
GIF vs JPEG
Listed here are the primary differences between the JPEG and GIF formats:
- JPEG is designed for photographs and naturalistic artwork. GIF is the better choice for lettering, simple cartoons and line drawings, because JPEG smudges the edges of sharply defined lines and color transitions when the compression factor is high.
- JPEG supports 16,777,216 colors (256 colors each for red, green and blue). GIF is limited to 216 colors and uses dithering to render the shades of color in between.
- A lot of people still have 256 color displays. JPEG files won't look nearly so good on a 256 color display. GIF files will display the same on yours as theirs.
- JPEG is "lossy" unless you set the compression factor at 0. Each time you open, edit and save, the quality goes down like making a series of copies of a audio cassette tape. Save your original JPEGs. GIF uses a loss-less compression algorithm so that files can be edited an unlimited number of times.
- GIF supports transparency (e.g. for a logo that can be placed over different backgrounds). A JPEG image can only be opaque.
- GIF supports animation and JPEG does not.
Portable Network Graphics (PNG) was designed to replace GIF. It dispenses with GIF's color 216 colors limitation and uses more effective compression algorithms. Color is 32 bits with 8 bits each for red, green, blue and transparency. Because it uses loss-less compression it is not a replacement for JPEG, which can achieve much greater file size reductions for photographs. Browsers, especially Internet Explorer, have been slow to support all of PNG's features. A variable transparency example that worked well with Netscape failed to even load with Internet Explorer. Internet Explorer does display simple PNG files, however it is somewhat unpredictable which PNG files it will decode. Internet Explorer offers better PNG support on the MAC.
Basic Multilingual Plane offers no compression, which is why it should never be used on a website unless the images are very small. BMP. Because BMP and PNG formats are loss less, they are excellent for original and edited libraries which can be converted to a more appropriate format for web pages. BMP features 8 bits each for red, green and blue with no animation or transparency.
JPEG On Older Displays
Some older PCs use out-dated graphic cards which do not have enough video RAM to support the full range of JPEG, PNG or BMP. Browsers will resort to color substitutions and/or dithering for your JPEG files in order to achieve a best approximation.
Something as important as a corporate logo, perhaps featured on all website pages, should be done with a GIF and not a JPEG, even though the GIF will be more challenging to get right. A GIF that looks right on your screen will look right on everybody else's screen.