Professional Documents
Culture Documents
Course: EE 4235
Subject: Digital Image Processing
Lecture 4
Image File Format
What is the difference between bitmap and vector images? » Images » Windows » Tech Ease (usf.edu)
Bitmap Image
❑ Bitmap (or raster) images are stored as a series of tiny dots called pixels. Each pixel is
actually a very small square that is assigned a color, and then arranged in a pattern to
form the image. When you zoom in on a bitmap image you can see the individual
pixels that make up that image. Bitmap graphics can be edited by erasing or changing
the color of individual pixels using a program such as Adobe Photoshop.
Vector Image
❑ Unlike bitmaps, vector images are not based on pixel patterns, but instead
use mathematical formulas to draw lines and curves that can be combined
to create an image from geometric objects such as circles and polygons.
Vector images are edited by manipulating the lines and curves that make up
the image using a program such as Adobe Illustrator.
Comparison Table Between Bitmap and
Vector
❑ Comparison Table Between Bitmap and Vector (in Tabular
Form)
Parameter of
Bitmap Vector
Comparison
Resizing the image affects its Resizing the image does not
Resolution
resolution. affect its resolution.
P6
1024 788
❑ Header example 2 # A comment
255
P3
❑ Header example 3 1024 # the image width
788 # the image height
# A comment
1023
PPM
❑ The format of the image data itself depends on the
magic PPM identifier. If it is "P3" then the image is given
as ASCII text, the numerical value of each pixel ranges
from 0 to the maximum value given in the header. The
lines should not be longer than 70 characters.
PPM example 4
P3
# example from the man page
44
15
0 0 0 0 0 0 0 0 0 15 0 15
0 0 0 0 15 7 0 0 0 0 0 0
0 0 0 0 0 0 0 15 7 0 0 0
15 0 15 0 0 0 0 0 0 0 0 0
PPM
❑ If the PPM magic identifier is "P6" then the image data is
stored in byte format, one byte per color component (r,
g, b). Comments can only occur before the last field of
the header and only one byte may appear after the last
header field, normally a carriage return or line feed. "P6"
image files are obviously smaller than "P3" and much
faster to read. Note that "P6" PPM files can only be used
for single byte colors.
❑ Therefore, the first pixel has an RGB value of (255, 0, 0), which
is literally red. The second pixel has an RGB value of (0, 255, 0),
which is literally green. And so forth. Looking back at our image
above, that is pretty accurate.
Common Colors
❑ Here are some common colors you should know on the top of
your head:.
Name Red Green Blue Preview
Black 0 0 0
Gray 127 127 127
Red 255 0 0
Green 0 255 0
Blue 0 0 255
Yellow 255 255 0
Magenta 255 0 255
Cyan 0 255 255
White 255 255 255
PGM format
❑ A popular format for grayscale images (8 bits/pixel)
❑ Closely-related formats are:
➢ PBM (Portable Bitmap), for binary images (1 bit/pixel)
➢ PPM (Portable Pixelmap), for color images (24 bits/pixel)
P1
# PBM example
24 7
000000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
011110011 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0
010000010 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
011100011 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0
010000010 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0
010000011 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0
000000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ASCII vs Raw/Binary format
❑ ASCII format has the following advantages:
➢ Pixel values can be examined or modified very easily
using a standard text editor.
➢ Files in raw format cannot be modified in this way since
they contain many unprintable characters.
❑ Raw format has the following advantages:
➢ It is much more compact compared to the ASCII format.
➢ Pixel values are coded using only a single character !
Text Format vs. Binary Format?
❑ Magic number and image format
Magic Number File Type Extension Type
❑ you can clearly see that P3 is defined as a PPM file that is Text-
based (ASCII). However, there are other variants. P6 is the binary version
of PPM.
PGM
❑ This format is identical to the above except it stores greyscale
information, that is, one value per pixel instead of 3 (r,g,b). The
only difference in the header section is the magic identifiers
which are "P2" and "P5", these correspond to the ASCII and
binary form of the data respectively.
❑ PGM example: An example of a PGM file of type "P2" is given below
P2
24 7
15
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0
0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0
0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0
0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0
0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Image Processing Software
❑ Image processing software is software that is
designed to manipulate digital images.
❑ In particular, it captures the image if that hasn't already
been done, it converts it to a digital form, and it
performs a manipulation or manipulations on it. For
example, have you ever seen someone lighten a
photograph that was too dark? Or crop an image to
remove unwanted background clutter. These are
examples of image processing at work. Its purpose is
to improve the contents and quality of an image.
Image Processing Software
❑ What Types of Image Processing Software are Available?
❑ Some of the categories, or types, they fall into:
❑ Computer Graphics
➢ Computer graphics is one kind of image processing because it processes 2D and
3D image definition files rather than the resulting images themselves. It is a fine
point, but worthy of note.
➢ Examples include maps, posters, videos, and movies.
❑ Computer Vision
➢ This type focuses on processing that helps the software recognize objects within
the viewing area.
➢ For example, some factories use computer vision to determine if particular steps in
their process have been completed successfully.
❑ Medical Imaging
➢ This type focuses on processing that helps with issue detection and diagnosis.
➢ Examples include; Bioimaging (non-invasive visualization of biological processes)
and Neuroimaging (visualization of the nervous system).
❑ Photo Editing
➢ This type focuses on processing that helps improve photographs, like changing the
brightness, contrast, or color skew.
➢ For example, when you brighten an overly dark photograph or crop out
background clutter.
Image Processing Software