1. Trang chủ
  2. » Công Nghệ Thông Tin

Taking Your Talent to the Web- P17 potx

15 233 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 15
Dung lượng 573,66 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

GIFs are not the format of choice for photography, paintings, and other subtly modulated images because they lack sufficient colors to reproduce these types of images and because the nua

Trang 1

Save the VisiBone swatch so it is always available when you work in Photoshop.

Now pat yourself on the back Many of your peers have no idea that this spe-cial swatch exists, that it comes bundled with Photoshop, and that it can greatly ease the creation of meaningful and attractive color schemes for the Web You are ahead of the game.

If you’re stuck using an older version of Photoshop or an alternative image editor, you can download the VisiBone palette free of charge at www.visibone.com While there, help yourself to additional VisiBone palettes for other software programs you or your teammates use, includ-ing Adobe Illustrator and ImageReady, Macromedia Fireworks, Bare Bones BBEdit, Jasc Paint Shop Pro, Allaire HomeSite, MetaCreations Painter, or the GIMP (an image editor for Linux) You need it; they’ve got it

For additional wisdom on the Color Cube, see Lynda Weinman’s site at www.lynda.comand David Siegel’s at www.killersites.com You also might

want to buy Weinman’s Designing Web Graphics and Coloring Web Graph-ics, both of which are available from New Riders Press, and are pretty much

the standard industry texts They are full of practical examples and offer stimulating and innovative ideas from the earliest days of web design

Another standard industry text, David Siegel’s Creating Killer Websites, is

also available from New Riders and also provides extensive information on the subjects we cover in this chapter It’s a beautifully written book full of great ideas, but it is also a book of its time (1996), and many of the prac-tices it preaches would now be considered harmful to the development of

a semantic Web based on W3C Recommendations We own and cherish this book, which was greatly influential in our development, and we recom-mend it as long as you know which of its visual techniques to shun (If you’re unsure, wait for the book’s third Edition…we hear it’s coming soon.)

F ORMAT T HIS : GIF S , JPEG S , AND S UCH

Raster images come in at least as many formats as there are software pro-grams and operating systems On the Web, however, we tend to use two formats almost exclusively: GIF and JPEG (As explained previously, ani-mated GIFs are a special instance of the GIF format.)

Trang 2

PNG is yet another web format, one that has been little supported in the past Some newer browsers have begun to support PNG, though it is still far from ubiquitous We will discuss it after thoroughly examining the GIF and JPEG formats—how they work, which types of images they deliver best, and how you can evolve strong stylistic concepts by understanding their limitations

GIF The Graphics Interchange Format (GIF) is older than the Web In fact it is older than some web designers GIF was developed in the 1980s by Com-puServe, and you’ll often hear old-timers speak of “CompuServe GIFs.” You’ll also hear them talk about walking 12 miles to a one-room school-house

The Compuserve folks pronounced the word as if it were the name of the peanut butter (“Jiff”) and because they were the inventors, that is the cor-rect pronunciation Millions of people pronounce GIF with a hard “G,” how-ever, so you might as well be a sniveling conformist and spend the rest of your career mispronouncing GIF while secretly suffering great guilt over it GIFs are usually seen with a GIF file extension, as in payme.GIF or payme.gif

The GIF format renders in 8-bit color or lower, at your discretion Two-color GIFs are not uncommon GIF permits you to achieve crude transparency effects by marking one of your 216 (or fewer) colors as “transparent.” How-ever, you must take care to anti-alias the foreground image against the transparent color, lest mismatched halos surround your graphics Fortu-nately, GIF renders specific colors exactly, so it is an easy matter to match web page backgrounds to image backgrounds The only caveat there is the previously mentioned heartbreak of 16-bit systems

Above all, GIF enables you to save bandwidth without sacrificing quality It

employs the Unisys-patented Lempel Ziv Welch (LZW) algorithm

(www.dogma.net/markn/articles/lzw/lzw.htm) to efficiently compress solid color areas while preserving crisp detail Though the format necessarily dis-cards colors—for instance, when rendering a 24-bit image as a 16-color GIF—it does not blur or eliminate significant image details For this reason,

the GIF algorithm produces what is known as lossless compression

Trang 3

Loves logos, typography, and long walks in the woods

This combination of crisp detail and efficient compression makes GIF the format of choice for line art including typography, logos, and illustrations

As mentioned earlier, the GIF format can also be used to create animated images When combined with JavaScript rollovers, animated GIFs can lend life and dynamism to a website They can also create nausea and ennui

With animation and rollovers, as with Tabasco, a little goes a long way

Animated GIFs have been supported in all graphical web browsers since Netscape 2.0 (1995), and nonanimated GIFs have been supported in graph-ical web browsers since before time began For now we will continue to discuss the merits and uses of static (nonanimated) GIFs

In spite of the fact that GIFs are found on millions of sites, the GIF format

is not a W3C-recommended web standard That’s because GIF gets its power from a patented algorithm Unisys, the patent holder, is entitled to charge royalties on any software that employs the LZW algorithm—in other words, any software that can read or write GIFs The revelation of Unisys’

right to charge a “GIF tax” spread panic among early web designers when

it became widely known only after the entire Web seemed to be built with GIF images It also led to the development of PNG, a GIF-like format with more advanced features and a nonproprietary compression algorithm

GIF “royalties” do not work in the way that, say, photo rights work You do not pay a fee each time you create a GIF image Instead, software compa-nies such as Adobe, Macromedia, and Corel render these tributes to Cae-sar You pay your share one time only, and it is hidden in the purchase price

of Photoshop, Fireworks, or any other software program that exports to the GIF format

GIFs are not the format of choice for photography, paintings, and other

subtly modulated images because they lack sufficient colors to reproduce these types of images and because the nuances in those images do not lend themselves to LZW compression Photographic images tend to render bet-ter in the JPEG format (or PNG), and we’ll get to those formats soon enough

Trang 4

GIFs in Photoshop

In Photoshop, you can choose whether to save your image as a standard or interlaced GIF The standard format is like a reader, taking in one letter after another, one word after another, one sentence after another Standard GIFs store and display the bytes comprising an image’s pixels in their order of appearance: The first pixel in is the first pixel out Thus, standard GIFs scroll onto the viewer’s screen pixel by pixel and line by line

The interlaced format is like a nervous reader who keeps skipping ahead— from paragraph one to paragraph five, then back to paragraph one Inter-laced GIFs load in a parallel rather than linear sequence, allowing the total image to be rendered more quickly and then with greater detail as addi-tional pixels are downloaded This allows viewers to get a sense of the image before it has finished downloading

Under the right conditions, interlaced GIFs might thus appear to load faster—and so may your site The appearance is deceptive given that

inter-laced GIFs are often a few bytes larger than standard GIFs and therefore

take a fractionally longer time to fully download Moreover, the slight benefits of interlaced GIFs often evaporate when other conditions are factored in

For one thing, the effectiveness of progressive GIFs depends on the viewer’s access speed With a super-fast connection, images load so quickly that any progressive rendering benefits are lost The format was something of a godsend not so long ago, when most web users were limited to 14.4 modems Today, few are stuck with such abysmal speeds

The effectiveness of progressive GIFs also depends on the browser Some browsers do not show anything at all until all images are fully loaded; in those browsers, the progressive aspects of the image are entirely wasted

If anything, in such browsers, progressive GIFs delay the page by adding a few bytes to the overall download time

Some browsers, such as Internet Explorer, give users a choice Users may view each image as it downloads (best with slow connections), or they may choose to wait for the entire page to download and assemble itself in mem-ory before appearing full-blown on the screen (best with fast connections) Users choose a viewing method in the Explorer Preferences dialog box You have no way of knowing or controlling these user preferences

Trang 5

Beginning web designers often ask if they can control the loading order of images on a web page Given what has just been explained, the answer is obviously “no,” because web users can choose (or their browsers may force them) to wait for the entire page to load Beyond that, HTML has no means

of controlling the loading order of images And even if it did support such nuances, the unpredictability of HTTP calls (explained in Chapter 2) means that one image might halt in mid-download, not even appearing until another, called much later, has already popped into place The more images per page, the greater the randomness of load order View a busy thumbnail image gallery sometime to see this in action, assuming your browser allows you to watch images download one by one

Avoid progressive GIFs when creating an image to be used as a background

Backgrounds do not appear until they have fully downloaded, so any “pro-gressive” effects will be lost Moreover, progressive GIF backgrounds can crash some older browsers

Progressive GIFs also can be hazardous to animations because each suc-ceeding frame of a progressive animated GIF will appear blurry, thus defeating the effort to create smooth motion effects

They’re not great for JavaScript rollovers, either You can offset the harm-ful, blurred quality of progressive GIFs in rollovers by preloading the images, a technique explained in the Chapter 11, “The Joy of JavaScript.”

When preloaded via JavaScript, images download and are stored in the viewer’s cache even though they do not appear on the web page until trig-gered by some action on the viewer’s part (typically, moving the mouse over

an image to which rollover effects have been applied) Any sane web designer who creates rollovers starts by preloading the alternate (replace-ment) images But if the images are going to be preloaded anyway, there’s

no sense in having them render progressively because the user will never see them until they have fully downloaded and cached

One last tip while we’re in this area Given that text loads instantly and images take time (see Chapter 2), designs that use HTML text above the fold will appear to load more quickly than those that bury their text fur-ther down on the screen A web user waiting for images is a web user with nothing to do (except, perhaps, hit the Back button) A web user reading

Trang 6

text has less anxiety about the fact that some images may not have fin-ished downloading With sufficiently engaging text, the user will feel that the site is responsive Keep this in mind when designing sites that require

a great many images

JPEG, the Other White Meat The Joint Photographic Experts Group (JPEG) format should be familiar to you from stock photo houses, digital cameras, and the Photoshop tutorial itself Usually seen with a jpgfile extension (as in landscape.jpg), JPEG sup-ports 24-bit color and preserves the subtle hue and brightness variations found in photographs and other continuous-tone images JPEG is therefore usually the format of choice when creating photographic images for the Web Like GIF, JPEG is widely supported in visual web browsers

Just as MP3 music files toss away audio harmonics to achieve compact file sizes, JPEG’s compression works by selectively discarding bits of image data Because a loss of quality is involved, JPEG compression is referred to

as lossy compression “Lossy” is an annoying word that looks wrong, but we

appear to be stuck with it In theory, the material discarded by the JPEG optimization process is data that is nearly invisible to the human eye (just

as audio data discarded by the MP3 format is supposed to go practically undetected by your ears, though we’ve never met a music fan who could not hear the difference) The greater the JPEG compression, however, the more visible the “missing data” becomes At extremely high compression ratios, JPEG images can display funky artifacts (see Figures 9.5 and 9.6)

Although JPEG is generally preferred for photographic images, when sharp detail is important, GIF is the better choice JPEG tends to soften images as

it compresses them Particularly when you are working with typography, the softness of JPEG images can ruin the effect of a web graphic Naturally, there is a workaround, as explained in the “Combining Sharp and Blurry” section later in this chapter

Unlike GIF, the JPEG format does not retain specific web-safe (or other) col-ors It promises you a rose garden, but the rose might be umber In a sil-houetted portrait where the edges of the image must match the background of the web page, you would therefore use GIF, not JPEG

Trang 7

Figure 9.5

At moderate JPEG compression levels, image details are clear, but file size is high.

Figure 9.6

At high JPEG compression levels, file size is low (minimizing bandwidth) but so is the quality Each JPEG optimization is an exercise in balancing file size versus quality of detail.

Trang 8

Photoshop’s Save For Web function provides a small, Matte Color dialog box that purports to save an exact background color of your choice, even

in the JPEG format (Skip ahead to Figure 9.7, if you must The Matte Color dialog appears at mid-right.)

Photoshop does all it can to fulfill this promise, but the JPEG format really

is not built to handle specific colors like this To viewers with 24-bit and higher systems, the background color will appear to match For 16-bit and lower users, the mismatch may be clearly visible So stick with GIF when you absolutely, positively, have to deliver a specific web-safe (or other) color

In Photoshop, you can choose whether to save your JPEG as a baseline

(standard) JPEG or as a progressive JPEG Progressive JPEGs display a

low-resolution version of the image almost immediately and then gradually come into crisper focus

As with progressive GIFs, under the right circumstances, progressive JPEGs can create the illusion that the site is loading faster As previously dis-cussed, this varies depending on the viewer’s access speed, browser func-tionality, browser preferences, and the caprices of HTTP And as in the discussion of GIFs above, when intended as background images, progres-sive JPEGs are a no-no unless you want some of your visitors to crash-crash

Optimizing GIFs and JPEGs When we export images such as GIFs and JPEGs, we choose the format most appropriate to the type of image we’re dealing with and then opti-mize it to create the best appearance possible, while using the least amount of bandwidth and computing resources

In addition to optimizing (reducing file sizes), the exporting process allows

us to further exert control over the color of our GIF images

Photoshop 3, 4, and 5 offered early web designers very little in the way

of optimization and color controls As a result, a number of inexpensive, third-party, shareware plug-in products specifically tailored to the needs

of web designers sprang up in the mid-1990s, most notably Boxtop

Trang 9

Software’s PhotoGIF, ImageVice, and ProJPEG (all are available at www.boxtop-software.com) These products were dandy (still are), but they did not come as standard equipment (still don’t) Arguably, they do a bet-ter job than Photoshop at handling some tasks

Fortunately, Photoshop 5.5 and higher, together with ImageReady, offers a number of tools to help web designers create the best-looking image while using the least amount of bandwidth Photoshop’s Save For Web command (found in File, Save For Web) enables web designers to preview the effects

of various compression settings on their images and then execute those settings and save the resulting web-ready images (see Figure 9.7)

The Save For Web dialog is powerfully compelling in the breadth and sub-tlety of its tools You can preview GIF versions using as few as two colors,

as many as 256, or anything in between You can use Adaptive, Selective, Perceptual, or web-safe color, with or without dithering, transparency, or interlacing (the “progressive” setting) You can skew images closer to or further from the web-safe palette as you desire You also can name and save custom settings for later application to similar images

Figure 9.7

Photoshop’s Save For Web dialog in action In this “four-up” view, the original image appears at the upper left for easy comparison with various optimization schemes of your choosing

Trang 10

Work on one optimization setting at a time or view three at once—and compare them with the original to check for image degradation and color shifting Get an instant readout of the effect your decisions will have on file size and downloading speed Enlarge images to check fine details Lock selected colors before trying a new set Shift one color at a time to its clos-est web-safe equivalent We feel like press agents We feel giddy We love this dialog box You will too

Images in Save For Web mode also may be previewed at various JPEG set-tings, both baseline and progressive, and again the tools are remarkably powerful

In general, the fewer the colors used in a GIF, the better it compresses This

is not because the color palettes themselves eat bandwidth; rather it is because of the way LZW compression works More on that in a moment in the “Expanding on Compression” section that is coming up next

Dithering images produces more photographic-like effects at the cost of slightly higher file sizes; images without dithering are smaller We find that typographic GIFs are often cleaner and more legible when saved without dithering Your mileage may vary You can create either type of image (and preview the results) in Photoshop’s Save For Web dialog box

After you decide which optimization scheme works best for a given image, the image can be saved in that format Your chosen settings may be retained indefinitely, and can even be applied (as a droplet) to an entire folder of images

Photoshop lets you name and store as many of these settings as you like

If a series of images you’ve created for Acme Widgets happens to work well

in 12 colors with no dithering at 60% web-safe, you can name that set-ting 12color_nodither (or acme_widgets or 60websafeor donaldduck if you prefer) You can then save it forever—or at least until your backup media deteriorates and what’s left of your hair is white and listless By then we’ll all be living on Mars while our clones do the work, anyway

Alternately, you can use the ImageReady module to satisfy your wanton image compression and formatting needs But Photoshop’s Save For Web

is just as effective, and the true power of ImageReady comes later in the process (and this chapter)

Ngày đăng: 03/07/2014, 07:20

TỪ KHÓA LIÊN QUAN