raster and vector graphics graphics 1 prepared by pranab bandhu nath lecturer cse department royal...

18
Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web: www.bandhutuhin.com

Upload: howard-howard

Post on 19-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

Raster and Vector Graphics

Graphics 1

Prepared By Pranab Bandhu Nath

LecturerCSE Department

Royal University Of Dhakaweb: www.bandhutuhin.com

Page 2: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

Introduction

• visual graphics in computers – raster graphics

• displaying and printing graphics

• limitations of raster graphics

• solution - vector graphics

Page 3: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

visual graphics in computers

• computers can only operate on, and store, numbers! when you type stuff on the keyboard, numerical electrical values are

sent to the processor when you see stuff on the screen it’s because numerical electrical

values that define position and colour have been sent by the processor

• the processor performs thousands of numerical operations in a fraction of a second when you press a key, the computer calculates which key has been

pressed, what it should do, and what information to send to the screen same thing happens when you use the mouse or a graphic tablet the calculations are so fast that you are not aware of the complexity of

the operations; you move the mouse - the pointer moves on screen, but the computer has done millions of sums to make that happen

Page 4: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

visual graphics in computers

• other input and output devices work the same way printers take numerical electrical values that define the position and

colour of dots on paper scanners convert printed material to numerical values cameras convert the light from a field of view to numerical values

• storing and transferring visual graphics requires numerical values when you save an image that’s displayed on your screen, numerical

values are stored on the disk as magnetic dots when you put files on a DVD numerical values are ‘burned’ onto the

surface as black dots on a reflective surface when you download an image from the web, or send one over email,

numerical electrical values are sent over the network

Page 5: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

raster graphics

• graphics that are displayed or printed are (almost always) ‘raster images’ from the Latin rastrum;

meaning rake rows of parallel lines

made from dots

• often called ‘bitmaps’ like squares coloured in

on graph paper each square can be

mapped to a location and given a numerical colour value

Page 6: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:
Page 7: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

computer display screens

• TFT LCD screens commonly display 72 or 96 ‘dots per inch’ the dots are known as ‘pixels’ each pixel is divided into three sub-pixels;

Red, Green and Blue (RGB)

Page 8: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

inkjet and laser printers

• printers commonly 300 to 600 ‘dots per inch’ dots are created by squirting ink, or

depositing powder onto the paper via an electrostatic process (like rubbing a balloon on your hair)

usually only three or four colours (Cyan, Magenta, Yellow, Black). Photo-real inkjets might also have a Photo-black and ‘Flesh-tone’

limited colour depth means that more dots are required than a TFT screen for the same reproduction

300dpi roughly the same as 72dpi TFT display

technique is called ‘dithering’ -

Page 9: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

commercial print works

• when your artwork is sent for production a similar process is used machine prints one colour at a time ‘colour separations’ are made, one for each of the four colours; Cyan,

Magenta, Yellow, Black, often called CMYK, or four-colour process dot size is used to control the mix of colours

• the number of dots per inch depends on the ‘frequency’ of the ‘screen’ before digital processes were developed, the original was photographed

through colour filters to create the separations a ‘screen’ (which looked like a fine net) was used to create the spaces

between the dots the number of lines in the screen determine the dots per inch newsprint is around 60 lines per inch, glossy magazine about 200 lpi

Page 10: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

scanners

• used to ‘digitise’ printed material original is placed on the glass a row of sensors moves along the image numerical level of light reflected from the original is recorded at set

intervals, eg 72 times per inch

• maximum resolution depends on the number of sensors per inch on the scanning head sensor outputs can be grouped to reduce the resolution to suit the task; low resolution original (eg newspaper) might be scanned at 60dpi original destined for use at low resolution treated the same way

• the higher the resolution, the larger the image A4 @ 600dpi might take up 100 times as much space as 60 dpi -

Page 11: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

digital photography

• a digital camera uses a matrix of light sensors light from field of view falls on matrix (bit like a TFT display in reverse) numerical values corresponding to light levels recorded

• resolution depends on the number of sensors in the matrix ‘6 Mega Pixels’ better than ‘1 Mega Pixels’

• lots of marketing nonsense involved 6Mp is more than good enough for professional graphics work; a 200 lines glossy magazine page = (8.25x200)x(11.75x200) = 3.88MP colour, tone and sharpness are far more important to image quality if you need photographs you need a photographer (or learn photography

yourself - a camera doesn’t make you a photographer!)

Page 12: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

limitations of raster images

• image stored as a raster image has a limited resolution cannot be enlarged beyond the resolution it was created at without

losing quality (pixilation)

• ‘large’ images at ‘high quality’ take up lots and lots of storage space expensive to archive, slow to send over network slow to load and manipulate in the computer

• only ‘bitwise’ manipulation is possible you must select groups of pixels for editing - you can’t select objects

once they’ve been rasterised into the image, eg text

Page 13: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

overcoming limitations of raster images

• images can be ‘compressed’ ‘lossless’ compression looks for opportunities to make the file smaller on

disk, eg large areas of black can be defined without mapping each bit individually

‘lossy’ compression uses clever algorithms to miss out information that humans hopefully won’t notice

• clever software helps with editing Photoshop has lots of tracing tools to help select objects, resampling,

adding ‘noise’, etc to help hide cut and paste borders, many others…

• some visual graphics can be converted to, or created in, non-raster formats many non-photographic images suitable for vector graphics formats

Page 14: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

vector graphics

• consider the basic graphic elements that make up a visual graphic; Shape Line Space Texture Colour

• how do we create a computer image? capture an existing image by scanning or photographing it create an original image (eg draw, paint) and then scan or photograph it create the image directly with the computer; keyboard, mouse, graphics

tablet, etc (ie the equivalent of drawing or painting) use a drawing package to create the image using basic graphic

elements!

Page 15: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

example - shapes

• can be divided into two categories; geometric shapes organic shapes

Page 16: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

• geometric shapes easily described mathematically eg circle: diameter; regular polygon: side-length and

number of sides other shapes may look complicated but are easy for the

computer to create, eg recursive patterns like fractals

example - shapes

Page 17: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

• organic shapes occur naturally those found in nature, free-hand drawings a few exceptions, eg crystals

• when we need to use an organic shape with a vector graphic we find a mathematical description sometimes we can simply use a regular shape in

place of the organic one we want to represent, eg a circle for the sun, an ellipse for a leaf

where a regular shape cannot be used, the organic shape must be replicated with a series of curves

• the curves we use are known as ‘Bezier curves’ and are intuitive to draw and manipulate visually

example - shapes

Page 18: Raster and Vector Graphics Graphics 1 Prepared By Pranab Bandhu Nath Lecturer CSE Department Royal University Of Dhaka web:

summary

• when we capture and display visual graphics in computers we use raster graphics

• raster graphics have serious limitations raster graphics take up lots of storage space and processing power,

especially large and/or high quality images cannot be enlarged without loss of quality graphic elements cannot be manipulated individually

• by converting raster images to vector format and creating original visual graphics in vector format, we can overcome these limitations

• to do this we combine shapes and Bezier curves