Chapter 3
Chapter 3
Institute of Technology
Department of Information Technology
Chapter 3: Data Representations
Graphic/Image Data Representation
An image could be described as two-dimensional array of points where every point is allocated its own
color. Every such single point is called pixel, short form of picture element. Image is a collection of
these points that are colored in such a way that they produce meaningful information/data.
Pixel (picture element) contains the color or hue and relative brightness of that point in the image. The
number of pixels in the image determines the resolution of the image.
A digital image consists of many picture elements, called pixels.
The number of pixels determines the quality of the image image resolution.
Higher resolution always yields better quality.
Bitmap resolution most graphics applications let you create bitmaps up to 300 dots per inch (dpi).
Such high resolution is useful for print media, but on the screen most of the information is lost, since
monitors usually display around 72 to 96 dpi.
A bit-map representation stores the graphic/image data in the same manner that the computer
monitor contents are stored in video memory.
Most graphic/image formats incorporate compression because of the large size of the data.
Fig 1 pixels
Types of images
There are two basic forms of computer graphics: bit-maps and vector graphics.
1
The kind you use determines the tools you choose. Bitmap formats are the ones used for digital
photographs. Vector formats are used only for line drawings.
Bit-map images (also called Raster Graphics)
They are formed from pixels--a matrix of dots with different colors. Bitmap images are defined by their
dimension in pixels as well as by the number of colors they represent.
For example, a 640X480 image contains 640 pixels and 480 pixels in horizontal and vertical direction
respectively.
To edit or modify bitmapped images you use a paint program.
Vector graphics
They are really just a list of graphical objects such as lines, rectangles, ellipses, arcs, or curves-called
primitives. Draw programs, also called vector graphics programs, are used to create and edit these
vector graphics. These programs store the primitives as a set of numerical coordinates and mathematical
formulas that specify their shape and position in the image. This format is widely used by computer-
aided design programs to create detailed engineering and design drawings. It is also used in multimedia
when 3D animation is desired. Draw programs have a number of advantages over paint-type programs.
These include:
Precise control over lines and colors.
Ability to skew and rotate objects to see them from different angles or add perspective.
Ability to scale objects to any size to fit the available space. Vector graphics always print at the
best resolution of the printer you use, no matter what size you make them.
Color blends and shadings can be easily changed.
Text can be wrapped around objects.
Image data types
Images can be created by using different techniques of representation of data called data type like
monochrome and colored images. Monochrome image is created by using single color whereas
colored image is created by using multiple colors. Some important data types of images are following:
An image is a set of pixels. Note that a pixel is a picture element in digital image. In 1-bit images,
each pixel is stored as a single bit (0 or 1). A bit has only two states either on or off, white or black,
true or false.
2
Therefore, such an image is also referred to as a binary image, since only two states are available. 1-
bit image is also known as 1-bit monochrome images because it contains one color that is black for
off state and white for on state.
A 1-bit image with resolution 640*480 needs a storage space of 640*480 bits.
640 x 480 bits. = (640 x 480) / 8 bytes = (640 x 480) / (8 x 1024) KB= 37.5KB.
The clarity or quality of 1-bit image is very low.
Each pixel of 8-bit gray level image is represented by a single byte (8 bits). Therefore, each pixel of such
image can hold 2 8=256 values between 0 and 255. Therefore, each pixel has a brightness value on a
scale from black (0 for no brightness or intensity) to white (255 for full brightness or intensity).
A gray scale digital image is an image in which the value of each pixel is a single sample, which carries
intensity information. Images are composed exclusively of gray shades, which vary from black being at
the weakest intensity to white being at the strongest. Gray scale images carry many shades of gray from
black to white. Gray scale images are also called monochromatic, denoting the presence of only one
(mono) color (chrome). An image is represented by bitmap. A bitmap is a simple matrix of the tiny dots
(pixels) that form an image and are displayed on a computer screen or printed.
A 8-bit image with resolution 640 x 480 needs a storage space of 640 x 480 bytes=(640 x 480)/1024
KB= 300KB. Therefore an 8-bit image needs 8 times more storage space than 1-bit image.
3
Fig 3 Gray-scale bit-map image
8-bit color graphics is a method of storing image information in a computer's memory or in an image
file, where one byte (8 bits) represents each pixel. The maximum number of colors that can be displayed
at once is 256.
A 8-bit color image with resolution 640 x 480 needs a storage space of 640 x 480 bytes=(640 x 480) /
1024KB= 300KB without any compression.
In 24-bit color image, each pixel is represented by three bytes, usually representing RGB (Red, Green
and Blue). Usually true color is defined to mean 256 shades of RGB (Red, Green and Blue) for a total
of 16777216 color variations. It provides a method of representing and storing graphical image
information an RGB color space such that a colors, shades and hues in large number of variations can
be displayed in an image such as in high quality photo graphic images or complex graphics.
4
Many 24-bit color images are stored as 32-bit images, and an extra byte for each pixel used to store an
alpha value representing special effect information.
A 24-bit color image with resolution 640 x 480 needs a storage space of 640 x 480 x 3 bytes = (640 x
480 x 3) / 1024=900KB without any compression. Also 32-bit color image with resolution 640 x 480
needs a storage space of 640 x 480 x 4 bytes= 1200KB without any compression.
Image Resolution
Image resolution refers to the spacing of pixels in an image and is measured in pixels per inch, ppi,
sometimes called dots per inch, dpi.
The higher the resolution, the more pixels in the image. A printed image that has a low resolution may
look pixelated or made up of small squares, with jagged edges and without smoothness.
Image size refers to the physical dimensions of an image. Because the number of pixels in an image is
fixed, increasing the size of an image decreases its resolution and decreasing its size increases its
resolution.
1. Popular Graphic/ Image File Formats
Choosing the right file type for your image to save in is of vital importance. If you are, for example,
creating image for web pages, then it should load fast. So such images should be small size. The other
criteria to choose file type is taking into consideration the quality of the image that is possible using the
chosen file type. You should also be concerned about the portability of the image.
To choose file type:
o resulting size of the imagelarge file size or small
o quality of image possible by the file type
o portability of file across different platforms
The most common formats used on internet are the GIF, JPEG, and PNG.
Standard System Independent Formats
A. GIF- Graphics Interchange Formats
It supports 256 colors. GIF format is the most popular on the Internet because of its compact size. It is
ideal for small icons used for navigational purpose and simple diagrams. If the image has less than 256
colors, GIF can easily render the image without any loss of quality. When the image contains more
colors, GIF uses algorithms to match the colors of the image with the palette of optimum set of 256
colors available. Better algorithms search the image to find and the optimum set of 256 colors.
5
B. PNG- Portable Network Graphics
PNG is the only lossless format that web browsers support. PNG supports 8 bit, 24 bits, 32 bits and 48
bits data types. One version of the format PNG-8 is similar to the GIF format. But PNG is the superior
to the GIF. It produces smaller files and with more options for colors. It supports partial transparency
also.
C. JPEG- Joint Photographic Experts Group
The JPEG format was developed by the Joint Photographic Experts Group. JPEG files are bitmapped
images. It stores information as 24-bit color. This is the format of choice for nearly all photograph images
on the internet. Digital cameras save images in a JPEG format by default. It has become the main graphics
file format for the World Wide Web and any browser can support it without plug-ins. It works well on
photographs, artwork and similar materials but not so well on lettering, simple cartoons or line drawings.
JPEG images work much better than GIFs. Though JPEG can be interlaced, still this format lacks many
of the other special abilities of GIFs, like animations and transparency, but they really are only for photos.
D. TIFF- Tagged Image File Format
The TIFF format was developed by the Aldus Corporation in the 1980 and was later supported by
Microsoft. TIFF file format is widely used bitmapped file format. It is supported by many image editing
applications, software used by scanners and photo retouching programs.
TIFF can store many different types of image ranging from 1bit image, grayscale image, 8 bit color image,
24 bit RGB image etc. TIFF files originally use lossless compression. Today TIFF files also use lossy
compression according to the requirement. Therefore, it is a very flexible format. This file format is
suitable when the output is printed. Multi-page documents can be stored as a single TIFF file and that is
way this file format is so popular. The TIFF format is now used and controlled by Adobe.
2. Digital Audio and MIDI
What is Sound?
Sound is produced by a rapid variation in the average density or pressure of air molecules above and
below the current atmospheric pressure. We perceive sound as these pressure fluctuations cause our
eardrums to vibrate. These usually minute changes in atmospheric pressure are referred to as sound
pressure and the fluctuations in pressure as sound waves. Sound waves are produced by a vibrating
body, be it a guitar string, loudspeaker cone or jet engine. The vibrating sound source causes a
disturbance to the surrounding air molecules, causing them bounce off each other with a force
proportional to the disturbance. The back and forth oscillation of pressure produces a sound waves.
6
Source---Generates Sound
Air Pressure changes
Electrical--Microphone produces electric signal
Acoustic.- Direct Pressure Variations
Destination --- Receives Sound
Electrical - Loud Speaker
Ears - Responds to pressure hear sound
How to Record and Play Digital Audio
In order to play digital audio (i.e WAVE file), you need a card with a Digital to Analog Converter
(DAC) circuitry on it. Most sound cards have both an ADC (Analog to Digital Converter) and a DAC
so that the card can both record and play digital audio. This DAC is attached to the Line Out jack of
your audio card, and converts the digital audio values back into the original analog audio. This analog
audio can then be routed to a mixer, or speakers, or headphones so that you can hear the recreation of
what was originally recorded. Playback process is almost an exact reverse of the recording process.
First, to record digital audio, you need a card which has an Analog to Digital Converter (ADC) circuitry.
The ADC is attached to the Line in (and Mic in) jack of your audio card, and converts the incoming
analog audio to a digital signal. Your computer software can store the digitized audio on your hard
drive, visually display on the computer's monitor, mathematically manipulate in order to add effects,
or process the sound, etc. While the incoming analog audio is being recorded, the ADC is creates many
digital values in its conversion to a digital audio representation of what is being recorded. These values
must be stored for later playback.
Common Audio Formats
There are two basic types of audio files: the traditional discrete audio file that you can save to a hard
drive or other digital storage medium, and the streaming audio file that you listen to as it downloads in
real time from a network/internet server to your computer.
Discrete Audio File Formats
Common discrete audio file formats include WAV, AIF, AU and MP3. A fifth format, called MIDI is
actually not a file format for storing digital audio, but a system of instructions for creating electronic
music.
A. WAV
The WAV format is the standard audio file format for Microsoft Windows applications, and is the
default file type produced when conducting digital recording within Windows.
7
It supports a variety of bit resolutions, sample rates, and channels of audio. This format is very popular
upon IBM PC (clone) platforms, and is widely used as a basic format for saving and modifying digital
audio data.
B. AIF/AIFF
The Audio Interchange File Format (AIFF) is the standard audio format employed by computers using
the Apple Macintosh operating system. Like the WAV format, it supports a variety of bit resolutions,
sample rates, and channels of audio and is widely used in software programs used to create and modify
digital audio.
C. MP3
MP3 stands for Motion Picture Experts Group, Audio Layer 3 Compression. MP3 files provide near-
CD-quality sound but are only about 1/10th as large as a standard audio CD file. Because MP3 files are
small, they can easily be transferred across the Internet and played on any multimedia computer with
MP3 player software.
D. MIDI/MID
MIDI (Musical Instrument Digital Interface) is not a file format for storing or transmitting recorded
sounds, but rather a set of instructions used to play electronic music on devices such as synthesizers.
MIDI files are very small compared to recorded audio file formats. However, the quality and range of
MIDI tones is limited.
Streaming Audio File Formats
Streaming is a network technique for transferring data from a server to client in a format that can be
continuously read and processed by the client computer. Using this method, the client computer can
start playing the initial elements of large time-based audio or video files before the entire file is
downloaded. As the Internet grows, streaming technologies are becoming an increasingly important
way to deliver time-based audio and video data.
For streaming to work, the client side has to receive the data and continuously ‘feed’ it to the ‘player’
application. If the client receives the data more quickly than required, it has to temporarily store or
‘buffer' the excess for later play. On the other hand, if the data doesn't arrive quickly enough, the audio
or video presentation will be interrupted.