Specifications
Image Formats
The GD library supports JPEG, PNG, and WBMP formats. It no longer supports the GIF for-
mat. Let’s briefly look at each of these formats.
JPEG
JPEG (pronounced “jay-peg”) actually stands for Joint Photographic Experts Group and is the
name of a standards body. The file format we mean when we refer to JPEGs is actually called
JFIF, which corresponds to one of the standards issued by JPEG.
In case you are not familiar with them, JPEGs are usually used to store photographic or other
images with many colors or gradations of color. This format uses lossy compression, that is, in
order to squeeze a photograph into a smaller file, some image quality is lost. Because JPEGs
should contain what are essentially analog images, with gradations of color, the human eye can
tolerate some loss of quality. This format is not suitable for line drawings, text, or solid blocks
of color.
You can read more about JPEG/JFIF at the official JPEG site:
http://www.jpeg.org/public/jpeghomepage.htm
PNG
PNG (pronounced “ping”) stands for Portable Network Graphics. This file format is seen as
being the replacement for GIF (Graphics Interchange Format) for reasons we’ll discuss in a
minute. The PNG Web site describes it as “a turbo-studly image format with lossless compres-
sion”. Because it is lossless, this image format is suitable for images that contain text, straight
lines, and simple blocks of color such as headings and Web site buttons—all the same pur-
poses for which you previously might have used GIFs.
It offers better compression than GIF as well as variable transparency, gamma correction, and
two-dimensional interlacing. It does not, however, support animations—for this you must use
the extension format MNG, which is still in development.
You can read more about PNG at the official PNG site:
http://www.freesoftware.com/pub/png/
WBMP
WBMP stands for Wireless Bitmap. It is a file format designed specifically for wireless
devices. Although gd supports this format, there are no PHP functions at present that take
advantage of this functionality.
Generating Images
C
HAPTER 19
19
G
ENERATING
IMAGES
403
24 7842 CH19 3/6/01 3:42 PM Page 403










