Notes - 1.2.1 - Multimedia - Graphics

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

1.2.

1
MULTIMEDIA: GRAPHICS
LEARNING OBJECTIVES
a) Show understanding of how data for a bitmapped image are encoded
b) Perform calculations to estimate the file size for a bitmap image
c) Show understanding of the effects of changing elements of a bitmap image on the image quality and file
size
d) Show understanding of how data for a vector graphic are encoded
e) Justify the use of a bitmap image or a vector graphic for a given task

1.2.1 (A) BITMAP IMAGE


Pixel
Pixel is short for Picture Element.

A pixel is the smallest addressable area defined by a solid colour. Each pixel is given a colour and brightness
value.

A pixel is the smallest identifiable component of a bitmap image.

An image is made up of many pixels. The quality of an image is called the resolution. The resolution depends
on the number of pixels per inch that make up the image.

The more pixels on the screen, the higher the resolution and the better the quality of the picture will be. The
higher the image resolution, the more memory is needed to store the graphic.
Image files can be either bitmaps or vectors.

Bitmap Image
The ‘bitmap image’ is built up from a large number of pixels. E.g. a 10 MegaPixel digital camera will use over 10
million pixels per image.

In a bitmap image, the pixels are stored as a two-dimensional matrix of pixels. The pixel has a position in the
matrix and has a colour. A pixel can be a small circle, a dot or a small rectangle – it does not matter.

When you zoom in the image too much, you can see the individual pixels. This is called pixilation.

A bitmap may be created using a simple drawing package or captured by scanning or a screen-shot.
Bitmap images are used on digital cameras, smartphones and on the Internet. Common bitmap image file
formats include JPEG, GIF, PNG and BMP. Bitmaps are also called pixelmaps or raster graphics.

Colour Depth (Bit Depth)


Colour depth is the number of bits used to store the colour value for each pixel.

Each pixel is addressable. A pixel can be only one colour at any given time. The colour within a pixel is normally
represented by 3 bytes. One byte for each of the three primary colours of Red, Green and Blue. An eight bit
scheme for each byte allows 256 different levels of each primary colour.

4 bits per pixel will be used for a grayscale image.

256 x 256 x 256 = 16 million

There are therefore 16 million colours are possible for each pixel.

Encoding Data
The colour of each pixel is stored as a binary number.

If the image is black and white then 0 is used for white and 1 for black.
The following illustration shows a bitmap that stores colours directly (24 bits per pixel) rather than using a
colour table. The illustration shows an enlarged view of the corresponding image. In the bitmap, FFFFFF
represents white, FF0000 represents red, 00FF00 represents green, and 0000FF represents blue.

B B B B B B B B
G R W R W R W G
G W R W R W R G
G R W R W R W G
G W R W R W R G
G R W R W R W G
G W R W R W R G
B B B B B B B B

File Header
This is a block at the start of the file and is used to identify the file. An application software (i.e. graphics
software) will read this block first to ensure that the file is actually a BMP and that it is not damages. The first
2 bytes of the BMP file format are the character “B” and then the character “M” in ASCII encoding.

The file header contains details such as:


 image resolution
 image height and width in pixels
 compression type
 size of image in bytes

Resolution
Resolution is the number of pixels representing an image (number of pixels per row multiplied by number of
pixels per column).
The higher the image resolution, the greater the image detail.
Image resolution indicates how close lines can be to each other and still be visible.

The resolution of an image is measured in dots per inch (dpi) or pixels per inch (ppi). The dpi determines the
amount of detail an image has.

Image Resolution
This is defined in the bitmap file. This means how many pixels horizontally and vertically representing the image.

DPI is a measure of dot density. It indicates the number of dots that can be placed in a line 1 inch (2.54 cm)
long.

If the final image is to be displayed on a computer then a resolution of 72-96 dpi is enough. If it is to be printed,
then 300 dpi is recommended.

Screen Resolution
The screen resolution is the number of distinct pixels that can be displayed. It is usually quoted as width x
height. This is different for each type of screen.

e.g. 1024x768 means the width is 1024 pixels and the height is 768 pixels.

The monitor is said to have a fixed-grid display since the number of pixels that can be displayed does not change.
A scaling engine is used if the image to be displayed is of a different size.

1.2.1 (B) ESTIMATING FILE SIZE OF BITMAP IMAGE


Note: An image often has areas of almost common colour and this can be used for image compression.

The bit depth must be considered when calculating the file size. This is how many bytes are used to store data
about each pixel. A 24-bit image (3 bytes) will be larger than an 8-bit image.

Black and white (monochrome) images have a bit depth of 1 bit (1 bit per pixel).

e.g. 1
A bitmap image which measures 3 inches by 4 inches and uses 16 bit colour is stored. The image has a resolution
of 250 dpi. Calculate the backing storage requirements of this image.

3 x 250 (to work out the length in pixels)


4 x 250 (to work out the height in pixels)
= 750 and 1000 respectively
750 x 1000
= 750,000 pixels
Space needed to store 1 pixel = 16/8 bytes
Space needed to store image= 750 000 * 2
Divide by 8 to convert to bytes.
= 1,500,000 bytes. Divide by 1024 to convert to kilobytes.
= 1464.84 kilobytes (KB). Divide by 1024 to convert to megabytes.
= 1.43 megabytes (MB)

e.g. 2
What are the storage requirements of a black and white image 250 by 400 pixels?
Total number of pixels = 250 * 400
= 100000

Space needed to store 1 pixel = 1 bit


Space needed for image = 100000 * 1
= 100000 bits
= 100000/8 bytes
= 12500 bytes
= 12500 / 1024 KB
= 12.2 KB

Estimating Space Requirements Pixels in a Coloured Image


In a monochrome image, only 1 bit per pixel is required (0 and 1 – one for black and one for white)

In an image having 5 colours, then 3 bits will be needed to store the colour value of each pixel.

4 2 1
1 1 1

The pixel values will range from 0 to 4 (5 different values in all).

1.2.1 (D) VECTOR IMAGE


Vector graphics are created in graphics package and consist of shapes called objects. It is possible to edit each
object separately. E.g. the shape, colour, size and position.

Even if an object in a vector graphics is quite large, it does not need a lot if computer memory. The file size of
a vector graphics is often very small.

Vector graphics are scalable. When you resize them, they do not lose quality.

Coordinates and geometry are used to precisely define the parts of the image.
E.g. of vector graphic:

a b

The instructions would be something like this:


1. Draw a dot at point “a”
2. Draw a dot at point “b”
3. Connect the dots together with a straight line
4. Colour the line red

Vector images are superimposed. A new vector object drawn will be placed on top of previous vector objects.

A vector graphic file contains a drawing list. This list contains commands for each object. Each command is a
list of attributes which define a property of the object.

A vector image is defined using mathematics and geometry such as points, lines, curves and shapes. Objects
and properties are stored mathematically.

Drawing List
This is a set of commands used to define a vector image.
Vector graphics are made up of objects and their properties.

Each of these objects has properties to tell you the size, colour, position, etc.
e.g. 1
<rect <circle
x=”14” cx=”100”
y=”23” cy=”100”
width=”250” r=”50”
height=”50” fill=”red”
fill=”green” stroke=”black”
stroke=”black” stroke-width=”5”
stroke-width=”1” />
/>

x and y give the top left start location for the rectangle.
The centre coordinates for the circle are given by cx and cy and r defines the radius.

It is possible to draw shapes one overlapping others. The shape drawn last will be on top of all the others.
You need to define x1,y1 and x2,y2 to define a line – these are the start and end coordinates.

The dimensions of the objects are not absolute but defined relative to an imaginary canvas. The image is
scalable. Calculations are done and the larger image is displayed. This avoids distortion.

1.2.1 (E) BITMAP V/S VECTOR IMAGE


Bitmap
Bitmap images are resolution dependent. It is difficult to
increase or decrease their size without sacrificing a
degree of quality. When you reduce the size of a bitmap
image through a software’s resample or scale commands,
you must throw away pixels. When you increase the size
of a bitmap image through your software’s scale
command, the software has to create new pixels. The
software must estimate the colour values of the new
pixels based on the surrounding pixels. This is called
interpolation.

Bitmaps are also better for photo editing.


Vector
You cannot scan an image and save it as a
vector file. You must create/draw it using
appropriate software. But you may convert a
vector image to a bitmap one. You can
specify the output resolution of the final
bitmap.
There is no background in a vector image but
the image is cartoon like.

Common image formats for vector images are


Shockwave Flash (SWF) and SVG.

https://www.youtube.com/watch?v=fy9Pby0Gzsc

Some images are not suitable for saving as a vector image. A detailed photograph would need so many vector
instructions to recreate it that it is better to store it as bitmap.

Bitmap v/s Vector Images

Bitmap graphics Vector graphics


What are they made up Pixels of different colours Objects (made up of lines equations and
of? calculations)
What can be edited? Individual pixels Individual objects
What is the file size? Large, as the computer stores Small, as the computer stores details of
details of every pixel objects, which do not require much memory
What happens when They lose quality They do not lose quality
they are resized?
How real do they look? Real Not real (many of them look like cartoon
images)
Processing Uses less processing Needs more CPU time
Memory Requirement Needs much memory space Does not take up a lot of memory space
Common file formats .bmp, .dib, jpeg, gif, tiff, .png .cgm, .svg, .odg, .eps, .xml

Meta files
A metafile is a graphic that contains both raster (bitmap) and vector data. E.g. a vector image that contains an
object that has a bitmap pattern applied as a fill. The object is still a vector but the fill attribute consists of
bitmap data.

Which one to choose?


When deciding whether an image should be a bitmap or vector graphic, you should ask yourself the following
questions:

 Does the image need to be resized?


 Does the image need to be drawn to scale?
 Do you need the image to look real?
 Do you have any restrictions on the file size?

Vector graphics are used in:


 CAD packages
 AutoShapes in Microsoft Office
 animated movies
 animation programmes (3D objects)
 image manipulation programmes such as Adobe Photoshop and GIMP
 Adobe portable document format (PDF)

Vector images are best used for logos and illustrations (diagrams and graphical designs). Raster images are the
standard in digital photography and commonly used for all graphics once they are published digitally.

You might also like