HTML and CSS Reference
In-Depth Information
Slide_10
Slide_13
Slide_15
Figure 21-2. Photos taken at various locations around Google's Mountain View campus
Look at Table 21-1 . Which two formats can you quickly take out of the running?
Table 21-1. Files Sizes of Various Browser-supported Formats
BMP
GIF
PNG
JPEG
WEBP
Slide_10
3072 KB
422 KB
1601 KB
378 KB
152 KB
Slide_13
3072 KB
666 KB
1986 KB
531 KB
243 KB
Slide_15
3072 KB
428 KB
1369 KB
303 KB
79 KB
BMP
Every browser supports BMPs, but they're almost never used, and Table 21-1 demonstrates why. BMPs are raw,
uncompressed RGB data. As such, they make for pretty huge image files. If you need lossless data, PNGs are always
smaller and support an alpha channel, so there's no good reason to use BMP.
GIF
GIFs are an odd historical artifact that refuses to die. Sporting unimpressive compression and palletized color, their
only upside (animation) is not one that WebGL can use effectively. Don't even bother with them for 3D content.
The rest of the image formats have pros and cons, and which one you use depends on your needs.
PNG
PNGs have several things going for them. First of all, they're lossless, which is very important for certain types of
texture information like normals. They can also store an alpha channel, which is obviously necessary for transparent
textures, but it can also be used to store extra data channels like specular information if transparency is needed. This
makes PNGs very versatile and, as such, they tend to be the default choice for many WebGL applications. You can
see from Table 21-1 , however, that the resulting images can still be fairly large, which is something that needs to be
weighed against the technical benefits. If you do find that you need to use PNGs I recommend looking at tools like
http://pngcrush.com to reduce their size.
 
 
Search WWH ::




Custom Search