Professional Documents
Culture Documents
image with 4
samples
(2x2)
Sampling
image with
8x8 samples
Image with
88X88 samples
Quantizing for Images
represent the color of each square with 1 bit
(only 2 colors)
NOTE: all these images have the exact same number of samples
Spatial Resolution
• A measure of the smallest discernible detail in an image
• When scanning or getting an image from our digital
camera, the scanner or the camera can determine how
many samples to take (how finely to break down the
images)
• The more samples that are taken, the higher the resolution
will be.
• Given in terms of dots(pixels) per inch
– Samples on scanners/printers are measured as dots per inch
(DPI)
– Samples on a monitor are measured as pixels per inch (PPI)
Example
• If we scan an 8 inch by 10 inch image at
100dpi, the image will be (8*100) * (10*100) =
800*1000 = 800,000 samples (almost 1 million
samples).
• QUESTION: What do we call a sample in an
image?
• Thus the above image would have 800,000
pixels.
Example
• If we scan the same image,8 inch by 10 inch,
at a resolution of 300dpi
– after scanning, we will get (8 * 300) * (10 * 300) =
7,200,000 pixels (about 7 million pixels)
• NOTE: when printing an image, you should
print with a dpi of at least 300.
Pixels in Digital Cameras
• How many megapixels (millions of pixels) you
can capture in a photograph on your digital
camera
• A table below shows relation between
megapixels and image sizes in digital cameras
Megabytes Size of image Total # of Printing at 300dpi,
(pixels WxH) Pixels biggest suggested print
◦ 32 pixels by 32 pixels
GIF Transparency
GIF Animation
• Allows for animation
• Don’t need a plug in for gif animation!
• Works in all browsers, universal format!
GIF Dithering
• Allows for dithering:
• Question: What do you think a program, that
converts images into gifs does, if the image
has more than 256 colors?
– Solution 1: Substitute one of the colors you have
for one of the colors you are missing
– Solution 2: dithering
GIF Dithering
• Juxtaposing (place side by side) pixels of two colors to
create the illusion that a third color is present (grainy
look)
• Example:
◦ Assume our image uses 257 colours
◦ The 257th colour that is not in our palette is:
◦ Assume we do have these 2 colours: and
◦ Thus dithering will change this
◦ To this
Another Example of Dithering
GIF Interlacing
• How images are downloaded to
your screen
• Interlacing lets you have a feel
for the whole picture, you
don’t have to wait around to
see it download (good for dial
up connections)
• a process by which the
image is drawn in a series of
passes rather than all at the
same time (file size bigger)
JPG (JPEG) – Joint Photographic Experts
Group
• Widely used on the World Wide Web
• Cross Platform (works on Macs, Windows)
• Supports 24 bit colour
• Great for photographs
• Larger file sizes than GIFs BUT allows for a full
colour scheme!
JPG
• Good for photographs, computer games, screenshots,
stills from a movie, etc
• Best for blends of color, softer shadow effects, subtle
changes in color
• Not good for well-defined lines or sharp contrasts
between colours
• Question: Guess which one is the GIF and which one is
the JPG:
JPG
• JPG does a lossy compression
– Discards more data about colours than about
brightness
• Not all of the information in the original image is
preserved – not the same as the original
• Compression is achieved by ‘forgetting’ certain
details about the image, which the JPG will then
try to fill in later when it is being displayed
• Degree of amount of information LOST
(lossyness) can be varied by adjusting
compression parameters. (controlled by you)
Original 0%
Compression = 100%
JPG
Quality
1. GIF
2. PNG
3. JPG