13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Underst<strong>and</strong>ing Image Formats<br />

485<br />

JPEG<br />

JPEG (pronounced “jay-peg”) st<strong>and</strong>s for Joint Photographic Experts Group <strong>and</strong> is really the<br />

name of a st<strong>and</strong>ards body, not a specific format.The file format we mean when we refer<br />

to JPEGs is officially called JFIF, which corresponds to one of the st<strong>and</strong>ards issued by<br />

JPEG.<br />

In case you are not familiar with them, JPEGs are usually used to store photographic<br />

or other images with many colors or gradations of color.This format uses lossy compression;<br />

that is, to squeeze a photograph into a smaller file, some image quality is lost.<br />

Because JPEGs should contain what are essentially analog images, with gradations of<br />

color, the human eye can tolerate some loss of quality.This format is not suitable for line<br />

drawings, text, or solid blocks of color.<br />

You can read more about JPEG/JFIF at the official JPEG site at http://www.jpeg.org/.<br />

PNG<br />

PNG (pronounced “ping”) st<strong>and</strong>s for Portable Network Graphics.This file format is the<br />

replacement for GIF (Graphics Interchange Format) for reasons we discuss shortly.The<br />

PNG website describes it as “a turbo-studly image format with lossless compression.”<br />

Because it is lossless, this image format is suitable for images that contain text, straight<br />

lines, <strong>and</strong> blocks of color such as headings <strong>and</strong> website buttons—all the same purposes<br />

for which you previously might have used GIFs. A PNG-compressed version of the same<br />

image is generally similar in size to a GIF-compressed version. PNG also offers variable<br />

transparency, gamma correction, <strong>and</strong> two-dimensional interlacing. It does not, however,<br />

support animations; for this, you must use the extension format MNG, which is still in<br />

development.<br />

Lossless compression schemes are good for illustrations but not generally a good way<br />

to store large photos because they tend to give large file sizes.<br />

You can read more about PNG at the official PNG site at http://www.libpng.org/<br />

pub/png/.<br />

WBMP<br />

WBMP, which st<strong>and</strong>s for Wireless Bitmap, is a file format designed specifically for wireless<br />

devices. It is not in wide use.<br />

GIF<br />

GIF st<strong>and</strong>s for Graphics Interchange Format. It is a compressed lossless format widely<br />

used on the <strong>Web</strong> for storing images containing text, straight lines, <strong>and</strong> blocks of single<br />

color.<br />

The GIF format uses a palette of up to 256 distinct colors from the 24-bit RGB<br />

color space. It also supports animations, allowing a separate palette of 256 colors for each

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!