| 2. Gif. This format
saves in only 256 colors or less, as opposed to the 16,000,000 of a Jpeg, but
has some definite uses, because it is not "Lossy". They can also be
saved with a transparent background, which .jpeg files cannot. I will explain:
if you have an image with a large area of a solid color, a compressed .jpeg will
distort that color, while a .Gif won't. Here is an example: 3.
PNG The .png format has some of the attributes of each of the above.
Called a "portable network graphic" it can be saved in either Optimized 256
color mode, or "True Color" at 16 million colors. Like the .gif it is
also not "Lossey" It will not get those blurry jpeg "color artifacts"
that you see in the image above. A good use of a .png file is if you need no
distorted colors, but would like the text to have a shadow, which .gif files
don't do very well. PNG files can be saved with transparency, like .gif files.
Try
saving an image in each of the three formats and comparing quality versus file
size. You will soon develop the skill of knowing which is best that way. Creating
graphics for the Web: Compression basics:
In order to get graphics to behave themselves on the Web,
we first have to compress them to take up as little room as possible, so that
it takes as little time as possible for the viewer to download them. Opinions
vary, but must people reckon that above 50K is getting too big, particularly if
you combine several images on a page. This has become less true as internet speed
has increased, but when creating graphics for the web, it should be kept in mind.
You've
almost certainly used compression before, probably with a product like Winzip
to pack down a graphic to fit on a floppy before sending it off in an email. The
two main Internet graphics formats, GIF and JPEG, have such compression built
in, but there are major differences between the two, as we shall see. Side
note: although GIF and JPEG are dominant there are other Web graphics formats,
such as PNG but for now, we'll assume that GIF and JPEG are universal. GIF
GIF, which stands for Graphics Interchange Format,
is a lossless method of compression. All that means is that when the program that
creates a GIF squashes the original image down it takes care not to lose any data.
It uses a simple substitution method of compression. If the algorithm comes across
several parts of the image that are the same, say a sequence of digits like this,
1 2 3 4 5, 1 2 3 4 5, 1 2 3 4 5, it makes the number 1 stand for the sequence
1 2 3 4 5 so that you could render the same sequence 1 1 1, obviously saving a
lot of space. It stores the key to this (1 = 1 2 3 4 5) in a hash table, which
is attached to the image so that the decoding program can unscramble it. The
maximum compression available with a GIF therefore depends on the amount of repetition
there is in an image. A flat colour will compress well - sometimes even down to
one tenth of the original file size - while a complex, non-repetitive image will
fare worse, perhaps only saving 20% or so. There are problems
with GIFs. One is that they are limited to a palette of 256 colours or less. Compuserve,
which created the GIF, did at one point say it would attempt to produce a 24-bit
version of the GIF, but then along came problem number two: Unisys. Unisys discovered
that it owned some patents to key parts of the GIF compression technology, and
has started demanding fees from every company whose software uses the (freely
available) GIF code. This has somewhat stifled development. There
is a 24-bit, license-free GIFalike called the PNG format, which uses 16 million
colors. It is very handy in creating web site graphics that need transpareny or
shadows. JPEG
JPEG, on
the other hand, is a lossy compression method. In other words, to save space it
just throws away parts of an image. Obviously you can't just go around discarding
any old piece of information so what the JPEG algorithm does is first divide the
image into squares (you can see these squares on badly-compressed JPEGs). Then
it uses a piece of mathematics called Discrete Cosine Transformation to turn the
square of data into a set of curves, some small, some big, that go together to
make up the image. This is where the lossy bit comes in: depending on how much
you want to compress the image the algorithm throws away the less significant
part of the data (the smaller curves) which adds less to the overall "shape"
of the image. This means that, unlike GIF, you get a say
in how much you want to compress an image by. However the lossy compression method
can generate artifacts - unwanted effects such as false colour and blockiness
- if not used carefully.
Web Graphics software handles the
images in pretty much the same way as far as compression goes, some such as the
Ulead products have an easier to use interface. |