Scanners enable us to use images to bring bland pages alive. This
white paper outlines what TWAIN is and how scanners operate
Before the advent of Windows and TWAIN, scanner users and
developers faced the difficult dilemma of drivers. For every
hardware device owned, users required a driver for every software
program owned. When there were only three different printers and
three different programs, only nine drivers were needed. But as the
number of printers, programs and other devices increased, so did
the number of drivers.
There are currently over 200 different printer types, over 20
image-editing packages and over 20 different scanners. If every
image-editing program was to work with every scanner and every
printer, there would be 80,000 different drivers to make everything
work with everything. Obviously the market couldn't survive like
this, either some items would go unsupported or the industry had to
find a better way. Enter Windows.Windows changed the way people
looked at peripherals. All printers are essentially the same,
varying only in detail and implementation. What Windows did was to
develop generic print services, so any program that wanted to print
would just print to the generic device and let Windows handle the
specifics.TWAIN is the standard that does the same for scanners.
All scanners basically produce the same type of information,
varying only in detail and implementation. The TWAIN specification
was written by a group of eight hardware and software companies.
TWAIN driver, TWAIN interface and TWAIN module are all synonyms for
a software module that allows image editing, optical character
recognition, desktop publishing and fax software to deal with the
scanner in a generic way. Users don't need to determine if "XYZ"
program supports scanner "ABC" before they buy it. Instead, they
just look to see if both support TWAIN.Through TWAIN and Windows,
the number of required drivers drops from 80,000 to a mere 220.
Popular Windows programs that support TWAIN include Adobe
PhotoShop, Corel Photo Paint, WinFax Pro, PageMaker, Picture
Publisher, iPhoto Plus, Fractal Design Painter, Microsoft
Publisher, Wordlinx OCR and TextBridge OCR.
Scanner mechanics (
how they workFor simplicity, we will discuss flatbed scanners
in this document. However, the basic principles also apply to hand
scanners and sheetfed scanners.You begin by placing a document face
down on the glass of your scanner and closing the lid. When you
press the scan button, the scanhead inside your scanner's chassis
begins to move. A fluorescent light on the scanhead shines light
upward onto your document or picture. This light is reflected
downward and hits a mirror in the bottom of the scanhead, which
reflects it towards a Charge Coupled Device (CCD), inside the
scanner's chassis.
Scanhead of a flatbed scannerThe CCD
contains an array of photosensitive cells that read the intensity
and/or colour of the light that hits them. The CCD works with an
analogue to digital converter to convert the light to a level
between 0 and 255 (0 being darkest and 255 brightest).The CCD is
what determines the optical resolution of your scanner. The most
common scanners have a 300 dot per inch (dpi) CCD. This means that
for every inch of width in the image, the CCD can sample 300
individual dots of colour. The scanner reads one line of data from
your document at a time. If you are scanning a 6ins. wide
photograph at 300 dpi, the scanner will send 6 x 300 or 1800
individual dots to the computer for the first line of data. The
motor will then move the scanhead to the next line. If your
photograph is 4ins. tall, the scanner will produce 4 x 300, or 1200
individual lines when scanning at 300 dpi. Each of these dots may
be a different colour and they are actually more like tiny squares
than round dots.If you were to take a large number of tiny ceramic
tiles made in a wide variety of colours, you could arrange them in
such a way that they would show a picture. When viewed from a
distance, your tile mosaic would not look jagged at all. But if you
came up for a closer look, you would see jagged edges between
various colours. The image produced by your scanner is basically a
tile mosaic made of many very small square dots. Using the example
above of a 4 x 6ins. photograph, the scanned image would consist of
2,160,000 dots. This is the product of 1200 x 1800 which were
calculated in the above paragraph. Your scanned image does not
appear jagged because the dots are very small.If you scanned in an
image of a postage stamp and magnified it five times, you would see
the mosaic dot pattern detected by the scanner. The stamp will
appear on your screen actual size. This is because computer
monitors have a resolution of 72 dpi. (Hint: Scan at 72 dpi for web
pages. If you scan higher than about 100 dpi, your images may not
fit on your web page unless, of course, they're as small as postage
stamps.)These tiny squares of colour are the data that a scanner
sends to the computer. Once you get the dots into your computer,
different software applications handle them in different ways.
Scan modesComputers represent pictures in a variety of ways.
The four methods that are most common are line art, halftone,
greyscale and colour.
Line art: Line art is the smallest of
all the image formats. Since only black and white information is
stored, the computer represents black with a 1 and white with a 0.
It only takes 1-bit of data to store each dot of a black and white
scanned image. Line art is most useful when scanning text or line
drawing. Pictures do not scan well in line art
mode.
Halftone: While computers can store and show greyscale
images, most printers are unable to print different shades of grey.
They use a trick called halftoning. Halftones use patterns of dots
to fool the eye into believing it is seeing greyscale information.
Greyscale: Greyscale images are the simplest of images for
the computer to store. Humans can perceive about 255 different
shades of grey. Computers represent greyscale information by
storing a number from 0 to 255 in a single byte. When you view a
greyscale image, it is equivalent to seeing a black and white
photograph.
Colour: Colour images are the largest and most
complex images to store. TVs and computer monitors mix the colours
red, green and blue to display all the colours visible to the human
eye. If you were to look at your computer screen right now through
a high powered magnifying glass, you would see that the white
background of this page is actually made up of high intensity red,
green and blue dots. A pixel is a group of three dots, one of each
colour. Because the dots are very tiny, your eyes blend them
together and you see white.The monitor's internal electronics can
vary the intensity of each colour dot to 256 different levels of
intensity. At the 0 intensity level, the dots are completely off
and the screen appears black. If the red and green intensity is 0
and the blue intensity is 255, you will see a rich blue colour like
the one above. By varying the intensity of each colour dot between
0 and 255, there are 16.77 million different combinations. Each
combination appears as a different colour. If the intensity of each
dot is set to an equal value, say 128, the monitor will appear as a
grey shade. 128 would be the level of 50 per cent grey. This is why
there are only 256 greyshades when scanning in greyscale
mode.Computers use 8-bits (1 byte) to represent each of the colour
components (red, green and blue). With 8-bits for each of the three
colours, there are a total of 24-bits to represent the entire
colour spectrum.
How to determine file sizeIf you're curious
how to determine how large a scanned image:File Size = (Resolution
x Horizontal Size) x (Resolution x Vertical Size) x Scan Mode where
Scan Mode = 1/8 for line art and halftone, 1 for greyscale and 3
for colourHere are the file sizes for a 4ins. x 4ins. photo at
various scan modes and resolutions. Notice that the greyscale files
are 8 times as large as the line art files. The colour files are 24
times as large as the line art files and 3 times as large as the
greyscale files.
InterpolationThe resolution of a scanner is
determined by the optical resolution of the CCD and the Stepping
Speed of the scanner's motor. A 300 x 600 dpi scanner has a 300 dpi
CCD and a motor that goes slow enough to scan 600 lines per inch as
it travels the length of the bed. If you scan at 300 dpi on such a
scanner, the motor runs twice as fast as it does when scanning at
600 dpi. If you scan at 600 dpi on such a model, the motor runs
slower and the scanner's hardware interpolates the horizontal data
from 300 up to 600 dpi. Basically, an integrated circuit chip in
the scanner generates new data where there is none through an
algorithm by averaging the colour of adjacent dots and creating a
new dot between them of the average colour. This is Hardware
Interpolation and it allows a 300 x 600 dpi scanner to produce a
600 x 600 dpi image. Software Interpolation can increase the
resolution even more than Hardware Interpolation. Software
Interpolation is performed by the TWAIN driver within the
Computer's CPU. This type of interpolation is quite misleading. It
does not create sharper images. Image quality and sharpness is
always limited by optical resolution. Software Interpolation merely
increases the amount of data in a scanned image. It is roughly
equivalent to scaling an image to make it larger.The only good
reason to scan at very high resolutions, such as 4800 dpi, is when
you need to enlarge an image dramatically. If the postage stamp
used above were scanned at 4800 dpi, the file size would be 19.1
Mb. This would increase to 76.4 Mb at 9600 dpi. If you were even
able to scan an 8.5ins. x 11ins. page in colour at 9600 dpi, you
would need a 12 Gigabyte hard drive to store the resulting file.
(Obviously, your computer would crash if you tried this.)All
graphic image file formats fall into two categories, either Bitmap
formats or Vector formats. Vector formats use mathematical formulas
to recreate graphics. If the graphic is a circle, the file format
will have the location of the circle's centre, its radius and other
pertinent information, such as what colour to draw the circle.
Vector formats are easily scalable without creating jagged edges,
but they are only suitable for simple drawings with a few colours.
Scanners do not use vector file formats.Bitmap formats store the
actual colour of each dot in the image. They are more suitable for
scanned images due to the large number of colours and complex tonal
variations in a photograph. A disadvantage to Bitmap formats is
that they create large files that take lots of drive space to
store. This problem is overcome by several bitmap file formats
which compress the data prior to storage on disk.Most scanning
programs, including iPhoto Plus and Picture Publisher, use the TIFF
file format as their default. TIFF files use compression but does
not shrink the file sizes significantly unless the image is black
and white (Scanned in Line Art Mode).Another popular file format is
the BMP file. This is the format Microsoft uses for Windows
Wallpaper. So if you want to use your own photos as Wallpaper, save
them in the Windows directory in the BMP format. The two most
popular bitmap file formats today are GIFF and JPEG. Both of these
formats are popular on the Internet because of their high
compression ratios.GIFF compression uses an algorithm similar to
ZIP files. It also reduces the number of colours in the image. A
scanned image can have up to 16.7 million colours. A GIFF file
reduces this down to a maximum of 256 colours. With appropriate
utilities, you can reduce this even further to 16 colours.
Obviously, you wouldn't want to do that with a photograph
though.JPEG does not reduce colour depth. It merely uses
compression algorithms similar to ZIP files. This is the most
popular format for scanned images on the Internet and for sending
pictures as attachments to email.
Compiled by Rachel
Hodgkins(c) 1999 Mustek Inc.