Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

Chapter -5

Image formats and color models


 Pixels -- picture elements in digital images
 Image Resolution -- number of pixels in a digital image
(Higher resolution always yields better quality.)
 width x height (e.g., 640X480)
 Most common Aspect ratio: 3:4 (lines:columns)
 Dots (pixels) per inch, dpi or ppi (e.g., 72 dpi)
 Bit-Map -- a representation for the graphic/image data in
the same manner as they are stored in video memory.
 Bits/pixel – also contributes to the quality of the image
Color Models
 Representing color on a computer is done by having a mapping
of colors to numbers.
 Such a mapping is called a color model.
 There are many color models, the 2 most widely used models are
RGB (additive) & CMYK (subtractive)
 RGB (red, green, blue) model assumes a blank picture is black
(no light) and describes what colored lights need to be added to
get a desired color. Red, green, and blue are the primaries.
 CMYK (cyan, magenta, yellow, key) model assumes a blank
picture is white (pure light) and describes what colored lights
need to be removed to get a desired color. Cyan, magenta, and
yellow are the primaries.
Color Depth
 Colors are virtually infinite in number since each color is a
wave.
 However, to the human eye, many colors are
indistinguishable from one another.
 Color Depth refers to number of bits of data used to
represent color.
 Using too few causes a loss of information.
 Using too many leads to a very large image size.
Digital Images
Digital images are a collection of pixels arranged in
rectangles.
Conceptually a pixel is a number that represents a
color depending on the color model.
In imaging a pixel represents a single point in a raster
image.
Monochrome (1 bit)
 1 bit of color per pixel (black and white)
 Assuming a perfect algorithm an uncompressed picture’s size is
1 (bit of color) * length * width
CGA (2 bit grayscale)
 2 bit of color per pixel (black, white, and 2 shades of gray)
 Assuming a perfect algorithm an uncompressed picture’s size is
2 (bits of color) * length * width
 The original Game Boy used 2 bits of color
 Because of advances in technology today’s grayscale generally uses 8
bits allowing 256 shades of gray.
3 bit RGB
 3 bit of color per pixel
 1st 2nd and 3rd bit represents presence of red, green and blue respectively
 000 – black 100 – red
 001 – blue 101 – magenta
 010 – green 110 – yellow
 011 – cyan 111 – white
 Assuming a perfect algorithm an uncompressed picture’s size is
3 (bits of color) * length * width
6 bit RGB
 6 bit of color per pixel (64 colors)
 2 bits for red, 2 bits for green, 2 bits for blue
 4 shades for each primary
 Assuming a perfect algorithm an uncompressed picture’s size is
6 (bit of color) * length * width
9 bit RGB
 9 bit of color per pixel (512 colors)
 3 bits for red, 3 bits for green, 3 bits for blue
 8 shades for each primary
 Assuming a perfect algorithm an uncompressed picture’s size is
9 (bits of color) * length * width
 Many older computers use 8-bit (256 colors)
 This is basically 9 bit color with 1 less bit for the blue channel, because
blue is less sensitive to the human eye.
Highcolor (15 bit RGB)
 15 bit of color per pixel (32,768 colors)
 5 bits for red, 5 bits for green, 5 bits for blue
 32 shades for each primary
 Assuming a perfect algorithm an uncompressed picture’s size is
15 (bits of color) * length * width
 Many computers use 16-bit (65,536 colors)
 This is basically 15 bit color with 1 more bit for the green channel,
because green is more sensitive to the human eye.
Truecolor (24 bit RGB)
 24 bit of color per pixel (16,777,216 colors)
 8 bits for red, 8 bits for green, 8 bits for blue
 256 shades for each primary
 Assuming a perfect algorithm an uncompressed picture’s size is
24 (bits of color) * length * width
32 bit RGB
 Widely used today.
 24 bit of color per pixel + 8 bits for extra data like transparency and
texture.
 Assuming a perfect algorithm an uncompressed picture’s size is
32 (bits of color) * length * width
Truecolor Representation
 To represent such a large number of colors using bits is not practical. Instead
we represent truecolor in two ways:
 RGB Color – a triplet representing red green and blue, each number can
go from 0 to 255
 rgb(255,0,0) – red
 rgb(255,127,0) – orange
 rgb(0,0,0) – black
 HEX triplet – 6 digits (2 red, 2 blue, 2 green), but each digit is represented
using base 16.
Possible Digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
 Hex triplets start with a pound sign and are always 6 digits.
 #FF0000 – red
 #FF7F00 – green
 #000000 – black
The most common formats used on internet are the
GIF, JPG, and PNG
GIF
 Graphics Interchange Format (GIF) initially for transmitting
graphical images over phone lines via modems.
 Uses the Lempel-Ziv Welch algorithm (a form of Huffman Coding),
modified slightly for image scan line packets (line grouping of pixels).
 LZW compression was patented technology by the UNISYS Corp.
 Limited to only 8-bit (256) color images, suitable for images with few
distinctive colors (e.g., graphics drawing)
 Supports one-dimensional interlacing (downloading
gradually in web browsers.
 Interlaced images appear gradually while they are
downloading. They display at a low dim resolution first and
then transition to full resolution by the time the download
is complete.)
 Supports animation. multiple pictures per file (animated
GIF)
 GIF format has long been the most popular on the Internet,
mainly because of its small size
 GIFs allow single-bit transparency, which means when you
are creating your image,
PNG
 stands for Portable Network Graphics
 It is intended as a replacement for GIF in the
WWW and image editing tools.
 GIF uses LZW compression which is patented by
Unisys. All user of GIF may have to pay fees to
Unisys due to the patent.
 PNG uses unpatented zip technology for
compression
JPEG/JPG

 A standard for photographic image compression


 created by the Joint Photographic Experts Group
 Intended for encoding and compression of photographs and
similar images
 Takes advantage of limitations in the human vision system
to achieve high rates of compression
 Uses complex lossy compression which allows user to set
the desired level of quality (compression). A compression
setting of about 60% will result in the optimum balance of
quality and filesize.

You might also like