[Clipart] Item for clipart FAQ
Bryce Harrington
bryce at bryceharrington.com
Fri Apr 9 14:30:04 PDT 2004
Q: What's the deal with all these different graphic formats? BMP, JPG,
GIF, PNG, SVG, WMF...?
A: With raster images, each format has certain strengths and weaknesses.
Formats like TIF and BMP are called "uncompressed" (in general). Each
pixel in the image is represented by a specific bit of data in the file.
Like you say, though, these are bulky. So some formats employ
algorithms to compress the data so that a bit of data may represent
several pixels. For example, in the GIF format if you have 100 blue
pixels in a row, instead of having 100 bits of data, it'd say, "blue
pixel x 100" which only takes a few bits of data. This is why GIF works
really good for images that have large areas of similar colors and high
amounts of regularity, like line art.
JPG, on the other hand, uses a different approach for achieving
compression. GIF, BMP, and TIF are called "lossless" formats; you can
take an image in one of those formats and convert it back and forth to
one of the other formats without any problem, and the image will always
maintain the same quality. JPG, on the other hand, is called "lossy",
which means that to achieve compression it _drops_ some of the data. It
does this using some known tricks to how the human eye works. This
works well for photographic images, less so for artwork, and extremely
poorly for line art.
The problem, as it relates to clipart, is that JPG's show their
artifacts when you zoom in or if you want to edit them. Since it's lost
some of its original info, when you save it again, it recalculates and
the quality becomes worse. The higher the compression ratio you use,
the faster it'll get bad.
PNG is considered a better format than either GIF or JPG, though it too
has a few tradeoffs. It is a lossless format so doesn't have the
problems that JPG has, but uses smarter algorithms than GIF. So while
it doesn't compress as tightly as JPG, it's *tons* better than GIF.
Unfortunately, it is a newer format so sometimes is not supported by
some applications; this is much less of an issue today than a few years
ago. PNG also includes support for several advanced features such as
alpha channels.
So that's the story with raster formats. Now, for this project, our
area of interest is going to be vector formats, at least initially.
The difference between raster and vector formats is very significant.
If you draw a circle and save it as a raster image such as BMP, what the
file will store is a bunch of data representing each pixel in the image,
some of which will be white, others black. The fact that it represents
a circle is lost; it takes a human to recognize that, oh, it's a circle.
In vector formats, what gets stored is the shape info. So if you draw a
circle, it'll store bits of info that means "circle of this radius at
this point in the drawing". What this means is that if you want to go
back and re-edit it, you can use your application's knowledge of editing
circles.
There's a lot more that can said about these image formats, but that's
basically it in a nutshell.
More information about the clipart
mailing list