Nubies' Corner
One of the most confusing aspects of
learning graphics on the Macintosh and other computer platforms is
learning file formats. It is so easy to get the details wrong about
each format, so, I'll try and explain a bit to see if I can clarify
the issues here. This is a long article with a lot of basic
information, so reading it in one sitting may not be the most
advantageous.
To understand computer graphics, one
must understand the pixel. A pixel is a single square dot on the
computer screen. Screen resolution, controlled in the Monitor Control
Panel, is a messurement of the number of vertical and horizontal dots
that fill the screen. This enlargement of a small portion of my
screen at the time I wrote this article (below) shows the tiny
squares that fill the screen. The resolutions available depend on the
monitor and the video card in the processor. Each has its own set of
resolutions of which it's capable. Common resolutions are 640 X 480,
800 X 600, 832 X 624, 1024 X 768, 1200 X 800 and on up. The first
number is horizontal width, the latter vertical height, (standard
ratio is 4 : 3) and they represent the number of dots that define the
size of the bitmap displayed on the screen. All images can be sized
by pixels, and when divided by image resolution (pixels per inch)
determine the size that the image will print. Screen resolution is
default at 72 pixels per inch, because it matches the font point
system where 72 point is one inch high.

Each square is comprised of three
color values, one for red, one for green, and one for blue. The
values are combined together to create a single value, which is
called RGB (for red, green, blue). I'll cover this color theory in
more detail in a later issue. In 8 bit color, there are two bits for
red, two bits for green, and two bits for blue, the remaining two
bits being for alpha, or transparency. In most cases where
transparency is not a factor, it is actually 6 bit color. In 16 bit
color, it has 4 bits for each color (12 bit color w/o transparency).
In 32 bit color, it has 8 bits per color (24 bit color w/o
transparency). Because the system always maintains transparency
capabilities, even if they are not used, the values w/o transparency
are never used when setting system color. These are only used in
professional color applications to indicate that transparency is not
a factor.
Let me also state that the native
format for Macintosh is PICT. If it exists within a Mac application
interface, it is a PICT file. The native screenshot function produces
a PICT file. It has dual identities in the first two categories and
has no compression in its pure form, though it can be compressed
using JPEG encoding, but then it become a JPEG format image.
The Windows counterpoint to Mac's PICT
is the BMP format, which has the same basic characteristics. But
being Windows, it was designed to be different enough to be different
from PICT, even though it is identical in every other way in terms of
system function except possible compression to JPEG. Both of these
formats may be saved in either 16 or 32 bit mode. Unless there is a
specific need for 16 bit, the default mode should be 32 bit, as it is
capable of smoother color.
This stated, I'll go onto discuss
formats.
All told, there are over 200 recognized
file formats for 2D image files, but many of them are so seldom used,
that I will only discuss the most common. With knowledge of the most
common, figuring out the lesser used formats will be easier. There
are three main factors and a few more minor factors that determine
the nature of a file format. Some files have more than one capability
for each category, and they are consequently larger in size because
of it.
1) Type (vector or raster)
2) Color encoding
3) Compression
The file type is the most important in
dealing with image files. The two types common to digital processing
are vector and raster.
Vector tends to be the smaller file
because of the way it deals with images, and it is the more flexible
in terms of image resizing. Vector is commonly called clip art when
in PICT format on the Mac (BMP in Windows). Clip art also exists in
EPS (Encapsulated Postscript) format for using with EPS compatible
laser printers. Vector formats are created by filling paths within a
window. The common shapes are rectangles(squares), ovals (circles),
and polygons which can be user defined. Using a path tool can also
create organic shapes. All the vector path tools have one thing in
common, and that is shaping points, which show up as little squares
(often in the corners) that allow the user to resize the image by
pulling and pushing on them with the cursor. If the corner can be
grabbed and enlarged, it is vector art. Images created in vector art
come from piling these colored shapes atop one another. The reason
that these files tend to be smaller than raster files is that it is
defined by the coordinates of the points on the paths, and not a
pixel by pixel definition.
Raster images, often called "paint",
are defined pixel by pixel using a bitmap. This bitmap is defined by
the original size of the image when it was created, and resizing them
can cause problems with image quality to which vector art is imune,
because of the way that the bitmap must adapt to a new pixel matrix.
It is important to get the size of a raster image right when first
creating it, or it will invariably lose some of its sharpness as the
original bitmap overlaps the new pixel boundaries unevenly, forcing
an averaging of the pixel values when set into the new size. However,
vector art can not represent photographic images, and this is the
main area where raster is used. Most raster image files contains RGB
values for each pixel in the image, though how each format does this
varies in the color encoding methods, and this encoding process is
one of the main reason there are so many different formats. However,
the one forte for raster is the ability to alter the image
mathematically, allowing for color correction, distortion, and the
use of filters to change the basic nature of the bitmap.
It is much easier to convert vector to
raster than it is to convert raster to vector.
Color encoding is the second most
influential factor on image formats. RGB is the default screen mode,
and many of the formats that are screen oriented use RGB.
One variation of RGB is grayscale,
where the red, green, and blue values for each pixel are equal.
Grayscale is most often used in B/W photoscans or converting color
images to B/W. The advantage of grayscale is that since the RGB
values are equal, the value only needs to be listed once instead of
three times, and this reduces file size to almost a third.
CMYK is often called "four color printing"
and is very similar to the red, blue, and yellow system used with
pigment paint. However, this is not the same, and the paint process
is solid and CMYK is dot printing, like that seen in newspapers and
magazines. C is for cyan (blue green, close to aqua), M is for
magenta (hot pink), Y is for yellow, K is for black (B is already
taken by blue). These are subtractive primaries, and they come from
mixing RGB light. Cyan is a mix of blue light and green light;
magenta, red light and blue light; and yellow a mix of green light
and red light. CMYK mode is used for ink printing and has no real
purpose for screen display.
There are other specific modes, such as
Lab Color, Pantone (an RGB to CMYK ink selection system), but these
are not involved in the common everyday computer formats. If you are
using these, you already know the formats and are probably making
money with them.
This leaves us with color palettes.
Color palettes are a set of RGB samples that are defined within the
file, and instead of using the RGB value for each pixel, the much
shorter position value in the matrix is used to define the colors.
There are two primary forms of color palettes, being Indexed Color
and CLUTs (Color Look-Up Table). The CLUT is almost always a resource
within an application (video games use them very often) or animation
file when more than one image or resulting frame must share the same
color table. Indexed Color is the most commonly used color palette
system in still image files. Indexed Color is the mode if a color
table such as the one below is used to select the colors being used.
The most common color table is called System Colors, and in 8 bit
mode, it is used to operate the screen colors. Windows naturally has
one that has slightly different color values.

Compression is the final major issue
in graphic file formats. Many formats that deal with exacting color
do not compress the files, as such compression can result in color
loss (values can change slightly to accomodate the compression.) The
most common use of file compression is used when file size is more
important than color quality, and the internet is the leading user of
compressed image files.
RGB compression, like that seen in JPEG
files, is a matter of relating the degree of change from one pixel to
the next, which is often much smaller than defining every pixel with
full RGB values. This is why in JPEG files that have been compressed
too much show "artifacts" or unsightly coloration where color changes
values very quickly, such as a dark line on a bright background.
Color Index files can also have
compression. GIF files have a process called LZW where when a single
color in a palette is used side by side in a long horizontal string
(blank color background), the string is defined, and when ever it is
encountered again, a much shorter alias is placed in the file,
removing the need to repeat the same value many times. There are
others as well, but most work on the same or similar process.
Vector art has some modest compression,
as in Flash format, but the savings there are far more geared toward
reducing general file information than image information.
So, with this all stated, here is a
table of the ten most common 2D graphics formats and their basic
characteristics and relative size. Note that there are other
differences not mentioned here, such as tags, but more than already
stating is pressing it for those not already familiar with graphic
file formats.
|
Format |
Type |
Color Mode |
Compression |
Use |
Relative Size |
|
|
|
|
|
|
|
|
PICT (Mac) |
Vector/Raster |
RGB/Indexed Color |
None |
Mac system |
Normal |
|
BMP (Windows) |
Vector/Raster |
RGB |
None |
Windows system |
Normal |
|
JPEG (JFIF) |
Raster |
RGB |
Variable, Lossy |
Internet |
Small |
|
GIF |
Raster |
Indexed Color 8 bit |
Possible |
Internet |
Small-Very Small |
|
TIFF |
Raster |
CMYK/RGB/IC |
None |
Printing |
Bloated |
|
TARGA |
Raster |
RGB/CMYK |
None |
Video |
Large-Bloated |
|
FLASH |
Vector |
Indexed Color |
By Format |
Internet |
Very Small |
|
PNG |
Vector/Raster |
Indexed Color |
Possible |
Internet |
Small |
|
Photoshop |
Raster (Vector-6) |
RGB/CMYK/IC |
None |
Layers, Editing |
Large |
|
EPS (Clip Art) |
Vector |
Indexed Color |
None |
Laser Printing |
Normal |