HOME
TOPICS
ABOUT ME
MAIL
|
|
technofile
Al Fasoldt's reviews and
commentaries, continuously available online since
1983
JPEG? GIF? TIFF?
The image format blues: How to know which one to
use
Oct. 30, 2001
By Al Fasoldt
Copyright © 2001, Al Fasoldt
I
explained a few weeks ago that JPEGs should be
considered bad news for anyone serious about digital
photography. But what about GIFs and other image
formats?
This is a good time to tell you
what's right -- and wrong -- about those other kinds of
images this week. You might be surprised.
The basic JPEG conundrum is this: Saving
your pictures as JPEGs strips out parts of your photos.
JPEG processing makes image files small by removing detail.
It's done in a clever way, so most of the time we
don't mind.
The problem -- and the reason I have
been telling you to avoid JPEGs when you're editing
your pictures -- can be summed up in one word: Loss. What
you lose when a JPEG image is saved can never be put back
in the picture.
That's why JPEG is called a lossy
image format. It losses things. And it's why Lossless
methods are essential. Never do any fixing, editing,
cropping or adjusting to a JPEG image. Always work on a
lossless version and save the results in lossless form.
The most common lossless format for
Windows is BMP. But BMP (pronounced bimp if you don't
mind snickering from the other side of the room, or Bee Em
Pee if you do) has a major liability. It's a
non-compressed format. It's lossless but its files are
big.
As I explained previously, PNG (Portable
Network Graphics, pronounced ping) is the up-and-coming
solution to the problem of compressing images without
changing them. PNGs are lossless, just as BMPs are, but
they have much smaller file sizes.
But as soon as I wrote about PNGs, I
heard from the GIF crowd and the TIFF folks. They made some
good points, so we'd better explain why GIF and TIFF
might make sense in some situations.
GIF stands for Graphics Interchange
Format, an image method owned by CompuServe. (It's
pronounced "jif" by most of the world, although
Mac users sometimes say it with a hard G as in
"garage.")
GIFs were the pioneers of Web images.
Long before JPEGs came along, GIFs were all over the place.
They're still popular, but they're dreadful for
pictures of you and me and Uncle Ben. They just don't
work for photos.
GIFs are ideal for images that have a
lot of sharp edges -- for anything that has text (letters
and numbers) in it, for example. GIFs preserve all the
precise shapes in an image, so they're perfect for
Web-page billboard ads (those are mainly text, right?) and
for the large headlines you see on Web pages.
JPEGs are terrible for images that
contain text, and they're useless when you need to show
sharp, clear objects.
Look at the main page on my
Technofile
site for a good example. The word Technofile is
large and very clear. It's a GIF image. You can see two
smaller versions of that identifying image, called a logo,
alongside this article. One is a GIF, just as clear as
ever, while the other is a JPEG, fuzzy and ugly.
We forgive JPEGs for this behavior
because our eyes are very forgiving -- and because pictures
of people and other real-life scenes usually don't have
sharp, clearly delineated edges. JPEGs work by futzing
things where one group of colors meets another. They smudge
up the edges of objects to hide the fact that details are
missing.
That works for Uncle Ben's beard and
Baby Julie's rattle, but it's bad news for the
letter T in Technofile. Smudge that up, pal, and you're
in big trouble. Likewise for any object with sharp edges
and clear shapes.
GIFs rescue us from vision
problems while keeping Web pages slim. But they can
only do that when they're used for text and similar
items, not for photos. (One similar item that cries out for
the GIF treatment is a cartoon. If you're going to put
a cartoon or any other kind of line art on your Web page,
save it as a GIF first. GIF is perfect for cartoons,
drawings and maps.)
(What follows is a technical explanation
of how GIFs are different from JPEGs. You can safely skip
it if you just want to get on with your life.)
The JPEG image-compression format makes
file sizes smaller by trimming out a great deal of detail.
It does this by removing pixels. Of course, if the JPEG
processing did this willy-nilly, we'd all be unhappy;
Aunt Minnie would look like a rubber duck. So instead of
stripping these pixels out in some sort of regular pattern
-- three out, one in, four out, two in, that sort of thing
-- JPEG processing does it randomly.
There's a lot of dreary technical
detail in the way it does this sort of random chop-chop
stuff, and I understand it about as well as I do the U.S.
Tax Code. So I'll just point out that the JPEG method
uses the Mike Tyson approach: It's brutal in the way it
gets stuff out of the way.
What you need to remember is not
that it takes out a lot of pixels (and not that it does it
the Mike Tyson way -- he's just a brute after all), but
that JPEG processing takes advantage of randomness.
GIF processing is the opposite. It takes
advantage of sameness. (I know this sounds too simple. But
it's true.) That means two things: First, images with a
lot of sameness give the GIF process a chance to strut its
squeezin' stuff, and, second, images that are mostly
random make the GIF process beg for mercy.
No kidding. A picture that shows a few
clouds floating in an expanse of blue sky doesn't have
much randomness (although the shape of the clouds might be
perfectly random in some ways), but it sure does have a lot
of sameness. Voila! (Or, as my musician friends say,
Viola!) That picture would be a good candidate for a
GIF.
Right?
Aw, I hate times like this. I
feel like I'm in a Monty Python routine. (How come I
never get to feel like I'm in a Benny Hill routine?
Life isn't fair.) I hate times like this because I feel
like I set you up for a punch line at your expense.
Here's why. That picture of a lot of
sky and a few clouds, the one with a lot of sameness, would
indeed be a good candidate for a GIF instead of a JPEG --
if GIFs could only deal with colors properly.
But they can't, and so it
isn't.
GIFs can show any color among a range of
256. (Technically, that's not strictly true, since the
limit of 256 includes black, which is not a color, and
white, which is also not a color. Black is the absence of
color and white is all colors mixed together, at least when
you are dealing with additive color theory. Don't get
me started on this. I might never stop.)
So forgive me if I say that GIFs can
show 256 colors even if the total is 254. Everybody else
calls 254 colors 256. So, in a world where 2 X 4 pieces of
lumber aren't really 2 inches thick and surely
aren't 4 inches wide -- go out and measure some if you
don't believe me -- we can forgive anyone who thinks
254 is the same as 256, at least for now.
Besides, that's a lot of colors no
matter how you do the math. Surely, 256 colors are enough
for any picture. Especially a photo of the sky, right? I
mean, blue is blue, more or less. Right?
Nobody needs to make much of a
point about this any more. In the bad old days of
personal computing, most computers couldn't show more
than 16 colors, and we considered ourselves lucky if we had
fancier computers that could show 256 colors. But when
256-color displays became common, we stopped fooling
ourselves and realized we needed more. Having only a total
of 256 colors is just plain inadequate. It's totally
weird. It's dumb. It's not enough.
That's because the blue you see in
the sky isn't some computer manufacturer's idea of
blue. It doesn't fit into a color wheel with 16 pie
slices of color. Or one with 256 tiny wedges of color.
The blue you see in the sky is God's
idea of blue, not quite this shade and not quite that one.
It's not the kind of color that can be depicted on the
Sherwin-Williams label. It's a natural color, and
natural colors seldom fit into a 256-color straight
jacket.
Showing azure blue, God's own shade
of azure blue, in an image limited to 256 colors just
doesn't work. Likewise for that wonderful shade of
burned crimson you see in the fall. Or that subtle
yellow-brown tint you've seen in faded azaleas. Or that
chromium hint in the sharp brown on glistening coffee.
Natural colors can't be
portrayed by a limited palette because they range all
over the spectrum. Showing real colors means you have to
show REAL colors, not a paint-by-the-numbers selection of
one person's idea of blue and someone else's notion
of green or red.
Our eyes aren't easily fooled,
either. They need a lot of real colors -- 50,000 or more
for starters, and probably a few million in most cases --
to be convinced that they are looking at real scenes.
(Don't confuse things by assuming that black-and-white
movies and videos -- if you can still find them! -- prove
that we don't need color for realism. Our eyes actually
see black-and-white images as multi-shaded gray scenes.
These black and white images aren't really black and
white anyway; they're grayscale images. Confused
enough? Let's move on.)
So any image format that can't show
more than 256 colors is a bozo when it comes to
photographs. For photos, you need something besides GIF.
(Hint: If you're still using a 256-color display on
your computer, get with the program. Raise it to the next
level, please.)
Why, then, should anyone use the GIF
format at all? Remember what I said about how great GIFs
are for text? Tell me, how many colors do you need for the
word Technofile? One is fine, thank you. And that one color
doesn't have to be Arctic Cheroot or Portnoy Mauve,
either; green will do fine, thank you. So a GIF's limit
of 256 possible colors means nothing for a Web-page image
that shows text. (Even a colorful GIF showing text
isn't likely to have more than a few colors. It surely
won't have 256.)
Another kind of image that's
ideal for GIFs: Cartoons. (A tip: When I say cartoons I
am talking about line drawings in general, not just
cartoons. Line drawings are pencil or pen drawings -- or
their computer equivalents -- and any other kind of artwork
that has only one color, generally black.) One-color
artwork, cartoons and line drawings are ideal for GIFs;
they're reproduced flawlessly. Likewise, maps are
perfect candidates for GIFs, too. Maps have sharp, clear
lines, simple colors and text -- the three kinds of items
GIFs handle so well.
Everyone who has been assuming that Web
pages should always use JPEGs should be doing cartwheels at
this point. The lesson is clear. Don't use JPEGs for
images that contain text. Don't use JPEGs for line art
such as cartoons, drawings and maps. JPEGs are for
photographs only. Use GIFs for anything that has text, for
cartoons and for such things as drawings and maps.
Whew! Why should it be so difficult?
Because we're still babes in the
digital woods, that's why. And because our software is
incredibly dumb. It should make all these decisions for us.
Until then, we need to know what works and what
doesn't, and why.
Let's forget Web pages for a
minute. My original article pointed out that PNGs are
better than JPEGs when you're storing or editing your
digital images, period. I wasn't referring to Web pages
or Web-page design.
And that's what brought out the
nitpickers from the TIFF brigade. TIFF (also called TIF and
pronounced just like you'd expect it to be) is another
image format. TIFF has a lot of fans, but unfortunately
they're usually not around when you need them.
That's because most TIFF users are professional graphic
artists or photo editors, and they're not likely to be
hanging around a digital water cooler chatting about
images. They're making a living using TIFFs, and that
means they're busy.
There's a secondary problem with a
lot of TIFFers. I've been harboring this for a couple
of years so I'd better let it go: A lot of TIFF users
are stuck-up Mac users who have no idea what is really
going on outside their cubbyhole. Say anything about
another image format to these folks and they just
snort.
To be fair to all seven Mac users in the
world, TIFF is the default image format for professional
and semi-professional image processing and editing. But
Windows and Linux users who try to stray into the TIFF fold
discover right away that they have to choose between a Mac
version of a TIFF and a Windows version (or non-Mac
version) of a TIFF. That's not just stupid; it's
insulting, too. Windows and Linux users outnumber Mac users
by about a billion to one, yet Mac users are still making
life difficult for all the rest of us by sticking to an old
method of doing TIFFs.
(Technically, the byte order of Mac
TIFFs is different from the order in non-Mac TIFFs. The
processing chips in Macs have an upside-down byte order
compared to the chips in PCs. Complicating this is the fact
that what I just said is literally untrue; I was
simplifying it, but it's too arcane to get into here. A
further complication is the fact that PC chips are the
guilty parties, because they're the ones with the
backward byte order. PC chips (the Pentium family, for
example) are so universal now that the backwardness almost
seems right. (Right-minded people might consider this
backwardness to be ssendrawkcab, however.)
So we need to forgive Mac users
and their backward TIFFs. As long as you recognize that the
world has two different kinds of TIFFs, feel free to use
TIFFs in your image storage and editing. If you're
using a Windows PC and your brother-in-law has a Mac, you
might find you can't share your non-Mac TIFFs with him;
you'd have to open them and then save separate versions
in Mac TIFF format. (Of course, you could simply use a
format both Macs and Windows PCs share without difficulty,
such as PNG.)
If your image-editing program has TIFF
as an option, it probably also lets you choose between
compressed TIFF and non-compressed. The type of compression
might also be selectable. LZW compression is common.
It's lossless (the picture is not degraded in any way)
but takes longer to save. If you have a fast PC, use LZW.
Otherwise, skip compression.
Other image formats you might
need to know about:
PSD (Photoshop Document), used by
Adobe's image-editing software. It's lossless and
ideal as an intermediate storage format while you are
working on images in Photoshop and other Adobe software
that uses PSD. Many other graphics programs can handle PSD
images, but I don't recommend PSD for the final version
of your image file. Use a universal format such as PNG
instead, or do what many serious photographers do and save
one copy in PSD format and another in TIFF or PNG.
FIF (Fractal Image Format), used
by an image-compression plugin (helper program) for
Photoshop and for programs that can use Photoshop plugins
(Photo-Brush, Paint Shop Pro, Corel Photo Paint and
others). Stay away from fractal image compression unless
you also save your images using standard, lossless formats.
(In that case, why use fractal compression anyway?) Fractal
compression will grow up someday. As of now, it has a
limited usefulness for most of us.
PICT (Picture), an old image
format used only by Macintosh computers. It's too
limited. Avoid it.
TGA (Targa), an almost forgotten
format invented by AT&T. Avoid it.
PCX (Picture Exchange), a format
useful in the early years of 16-color displays. Avoid
it.
|
|