Image Representation
Course Code: CSC 3224 Course Title: Computer Graphics
Dept. of Computer Science
Faculty of Science and Technology
Lecturer No: 03 Week No: 2 Semester: Fall 2024-2025
Lecturer: Noboranjan Dey,
[email protected]Outline
1. Pixel
2. Graphics Image
3. Color Model (RGB, CMY)
4. Direct Coding
5. Lookup Table
6. Display Monitor
7. Printing
8. Image Files
9. Books
10.References
Pixel
• A pixel is one of the many tiny dots that make up the
representation of a picture in a computer's memory.
• Pixels in an image can be reproduced at any size without the
appearance of visible dots or squares
• The intensity of each pixel is variable; in color systems, each
pixel has typically three or four dimensions of variability such
as red, green and blue, or cyan, magenta, yellow and black
Pixel
Computer Graphics Image
Computer graphics can be created as either raster or vector
images
Raster Image
Vector Image
Raster Image
Raster graphics are bitmaps.
• A bitmap is a grid of individual pixels that collectively compose
an image.
• Raster graphics render images as a collection of countless tiny
squares.
• Each square, or pixel, is coded in a specific shade. Individually,
these pixels are worthless
• Together, they’re worth a thousand words
Raster Image
Using of Raster Image
Raster graphics are best used for non-line art images; specifically
digitized photographs, scanned artwork or detailed graphics
Non-line art images are best represented in raster form because
these typically include subtle chromatic gradations, undefined lines
and shapes, and complex composition
Drawbacks of Raster Image
• Resolution in raster graphics is measured in dpi, or dots per inch.
The higher the dpi, the better the resolution
• Raster files are significantly larger than comparable vector files,
high resolution raster files are significantly larger than low
resolution raster file
• Overall, as compared to vector graphics, raster graphics are less
economical, slower to display and print, less versatile and more
unwieldy to work with
Example of Raster Image
Common raster formats include TIFF, JPEG, GIF, PCX and
BMP files
Vector Image
Unlike pixel-based raster images, vector graphics are
based on mathematical formulas that define geometric
primitives such as polygons, lines, curves, circles and
rectangles
Use of Vector Image
Because vector graphics are composed of true geometric
primitives, they are best used to represent more
structured images, like line art graphics with flat, uniform
colors.
Most created images meet these specifications, including
logos, letterhead, and fonts.
Advantages of Vector Image
Vector-based graphics are more malleable than raster
images
They are much more versatile, flexible and easy to use
The most obvious advantage of vector images over
raster graphics is that vector images are quickly and
perfectly scalable
There is no upper or lower limit for sizing vector images
Advantages of Vector Image
Unlike raster graphics, vector images are not resolution-
dependent
Vector images have no fixed intrinsic resolution, rather
they display at the resolution capability of whatever
output device (monitor, printer) is rendering them
Because vector graphics need not memorize the contents
of millions of tiny pixels, these files tend to be considerably
smaller than their raster counterparts.
Vector Images
Overall, vector graphics are more efficient and versatile.
Common vector formats include AI, EPS, CGM, WMF and
PICT (Mac).
Color Model
A color model is a system for creating a full range of colors
from a small set of primary colors.
There are two types of colour models: additive and
subtractive.
Additive and Subtractive
Model
Additive color models use light to display color
While subtractive color models use printing inks.
Colors perceived in additive models are the result of
transmitted light.
Colors perceived in subtractive models are the result of
reflected light.
RGB and CMYK
RGB
RGB uses additive color mixing, because it describes what kind
of light needs to be emitted to produce a given color.
Light is added together to create form from out of the darkness.
RGB stores individual values for red, green and blue.
(r,g,b)=>(0,0,0) black, (1,1,1) white [ranges 0 to 1]
RGB
RGB Value
A color's RGB value indicates its red, green, and blue intensity.
Each intensity value is on a scale of 0 to 255
RGB Color Palette
3-bit RGB
Systems with a 3-bit RGB palette use 1 bit for each of the red,
green and blue color components. That is, each component is
either "on" or "off" with no intermediate states. This results in an
8-color ((21)3 = 23 = 8) palette
6-bit RGB
Systems with a 6-bit RGB palette use 2 bits for each of the red,
green, and blue color components. This results in a (22)3 = 43 = 64-
color palette
Color Palette
In computer graphics, a color palette is a finite set of colors.
Palettes can be optimized to improve image accuracy in the
presence of software or hardware constraints.
CMYK
CMYK
CMY
CMY uses subtractive color mixing used in the printing process, because it
describes what kind of inks need to be applied so the light reflected from the
substrate and through the inks produces a given color.
One starts with a white substrate (canvas, page, etc.), and uses ink to
subtract color from white to create an image.
CMYk stores ink values for cyan, magenta, yellow, Key(Black).
cmyk(c%, m%, y%)=>(0%,0%,0%) white. [ranges from 0 to 100%]
RGB to CMY
C = 1 –( color.R / 255.0);
M = 1 – (color.G / 255.0);
Y = 1 – (color.B / 255.0);
RGB to CMY
R = (1 - C) * 255.0,
G = (1 - M) * 255.0,
B = (1 - Y) * 255.0
RGB -> CMY -> RGB
More info
http://colormine.org/convert/rgb-to-cmy
Sample Code:
https://github.com/THEjoezack/ColorMine/blob/
master/ColorMine/ColorSpaces/Conversions/
CmyConverter.cs
Direct Coding
• Basically images are the collections of several pixels
with colors. In computer graphics, direct coding is an
algorithm that provides some amount of storage
space for each pixel so that the pixel is coded with a
color.
Direct Coding
Storage space for each pixel to code the color
Use 3 bits per pixel (1 for R, 1 for G and 1 for B)
[Industry standard]
256 different intensity level for each color
Direct Coding
More info of direct coding:
https://www.chegg.com/homework-help/definitions/
direct-coding-3
Lookup Table
In computer graphics, lookup tables are used to
store the starting addresses of each line and the
values corresponding to the placement of pixels
within a byte.
Steps to plot a point using lookup table
1. Locate the starting address corresponding to the line
on which the point is to appear.
2. Locate the address of the byte in which the point will
be represented.
Lookup Table
Pixel values do not code colors directly
Refer to a table of color values
A table with 256 colors with RGB values
Display Monitor (CRT)
Printing
Halftone
Go through chapter 2 (schaum’s outline) for details.
Halftone
Halftone is the technique that simulates continuous
tone imagery through the use of dots.
Dots can be varied either
• in size
• in shape or
• in spacing
Halftone generates a gradient like effect.
Halftone Image
A halftone, or halftone image, is an image comprised
of discrete dots rather than continuous tones. When
viewed from a distance, the dots blur together,
creating the illusion of continuous lines and shapes.
By halftoning an image (converting it from a bitmap to
a halftone), it can be printed using less resources
How Halftone work
Halftone process, in printing, a technique
of breaking up an image into a series of
dots so as to reproduce the full tone range
of a photograph or tone art work.
Example
Contd.
Contd.
Books
• Foley, van Dam, Feiner, Hughes, Computer Graphics:
principles and practice, Addison Wesley, Second Edition.
• Schaum's Outline of Theory & Problems of Computer
Graphics.
• Peter Shirley Steve Marschner , “Fundamental of
computer graphics”, Third Edition.
References
• http://colormine.org/convert/rgb-to-cmy
• www.howstuffworks.com
• www.wikipedia.com
• http://www.picturetopeople.org/image_effects/photo-halftone/examples/photo-to
-halftone-convertion-2.gif
• http://mocoloco.com/fresh2/upload/2011/12/halftone_calendar_by_casey_klebba
/halftone_calendar_casey_klebba_3b-thumb-468x468-35319.jpg
• https://www.chegg.com
• https://www.slideshare.net/mustafasalam167/color-model-29181025
• https://www.printcnx.com/resources-and-support/addiational-resources/raster-ima
ges-vs-vector-graphics/
• https://slideplayer.com/slide/5143930/