http://en.wikipedia.org/wiki/raster_graphics. graphics an image is made up of tiny dots called...

29
Representation of Bitmapped Graphics BIT 101: Lecture 14 http:// en.wikipedia.org/wiki/Raster_graphic s

Upload: ira-johnston

Post on 05-Jan-2016

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Representation of Bitmapped Graphics

BIT 101: Lecture 14

http://en.wikipedia.org/wiki/Raster_graphics

Page 2: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

GraphicsAn image is made up of tiny dots called pixels (“picture elements”)

The resolution determines the quality of the picture. The smaller the pixels the finer the detail that can be displayed on the screen.

300 dpi25 dpi

Page 3: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Graphics PackagesGraphics packages can be classed as either:

Bitmapped / Raster graphics Vector graphics

http://en.wikipedia.org/wiki/Vector_graphics

http://en.wikipedia.org/wiki/Raster_graphics

Page 4: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Bitmapped GraphicsThe image is saved in a two dimensional array using binary numbers to represent the colors in the pixels. Each pixel is represented by the same number of bits.

0 0 1 1 1 1

1

1

1

1

1111

0

0

0 0

0

0

0

0

0

0

0

0

0

0

0 0

1

1

1

1

0

0

0

0

0

0

0

0

0

00

0

0

01 1

0 0 0 0

0 0

0 0

1 10 0

1 1

In this example, two colors have been used (black/white) and each

pixel is represented by one bit (“monochrome”)

0 = white, 1 = black

Page 5: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Bitmapped GraphicsIn this example, four colors are used in the graphic and each

pixel is represented using two bits.

00 = white, 01 = blue, 10 = red, 11 = black

00 00 10 10 10 10 00 00

00 0000 00

00 0000 00

00

00

10

10

10

10

10

00

00

1000 0001 010000

00 0000 0000

00

00

00

00

00

11

11

11

1100 0011 11

00 00 0011 11

11 11

00

0000 00 0000 00

Page 6: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Bitmapped GraphicsHow many colors could be represented using 3 bits?

Page 7: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Bitmapped GraphicsHow many colors could be represented using 3 bits?

000

001

010

011

100

101

110

111

8 colors (23) could be represented using 3 bits (3bpp )

Page 8: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Bit DepthThe number of bits used to represent the color of the pixels

is called the bit depth.Colors Bits or Bpp

2 1

4 2

8 3

16 4

32 5

64 6

128 7

256 8

65536 16

16777216 24 (True Color)

Page 9: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Color Depth

http://en.wikipedia.org/wiki/Color_depth

Page 10: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Resolution

http://en.wikipedia.org/wiki/Display_resolution

Page 11: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Refresh Rate

http://en.wikipedia.org/wiki/Refresh_rate

Page 12: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Bitmap Storage8 Pixels x 8 pixels x 1 bit = 64 bits in theory

• BITMAPHEAD• BITMAPINFOHEADER• RGBQUAD array• COLOR-INDEX array • Operating System file system info

Something like 752 bits (or 94 bytes)

Page 13: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the
Page 14: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Indexed to a palette

Page 15: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the
Page 16: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the
Page 17: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the
Page 18: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the
Page 19: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Exercise 1: Storage RequirementsAn image, 5 inches by 7 inches is stored at 600 dots per inch (dpi) using 65536 colors.

How much memory would be required to store this image?

7 inches

5 inches

Page 20: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Storage Requirements (examples)Pixels used to store image = (5 x 600 dpi) x (7 x 600 dpi)= 12,600,000

Image size 5 in x 7 in

DPI 600

Colors 65536

Page 21: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Storage Requirements (examples)Pixels used to store image = (5 x 600) x (7 x 600)= 12,600,000

65,536 colors = 16 bits = 2 bytes

Image size 5 in x 7 in

DPI 600

Colors 65536

Page 22: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Storage Requirements (examples)Pixels used to store image = (5 x 600) x (7 x 600)= 12,600,000

65,536 colors = 16 bits = 2 bytes

Amount of memory = 12,600,000 x 2 bytes

= 25,200,000 bytes

= 25,200,000 / 1024 / 1024

= 24.03 Mb

Image size 5 in x 7 in

DPI 600

Colors 65536

there are 1024 bytes in a kilobyte there are 1024 kilobytes in a megabyte

Page 23: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Exercise 2: Storage RequirementsA 10 inch by 8 inch photograph is stored at 1200 dpi using 256 colors.How much memory would be required to store this image?

10 inches

8 inches

Page 24: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Storage Requirements (examples)Image size 10 in x 8

in

DPI 1200

Colors 256

Pixels used to store image = (10 x 1200) x (8 x 1200)= 115200000

Page 25: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Storage Requirements (examples)Image size 10 in x 8

in

DPI 1200

Colors 256

Pixels used to store image = (10 x 1200) x (8 x 1200)= 115200000

256 colors = 8 bits = 1 byte

Page 26: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Storage Requirements (examples)Image size 10 in x 8

in

DPI 1200

Colors 256

Pixels used to store image = (10 x 1200) x (8 x 1200)= 115200000

256 colours = 8 bits = 1 byte

Amount of memory = 115200000 x 1 byte

= 115200000 bytes

= 115200000 / 1024 / 1024

= 109.86 Mb

Page 27: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Advantages of bitmapped graphicsThe file area is fixed

The A4 page in the previous slide will need 110 Mb of memory irrespective of the size of the graphic on the page.

The graphic can be edited to pixel level

Page 28: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Disadvantages of bitmapped graphicsEnlarging the image causes a loss in quality

An A4 page using 256 colors at 1200 dpi will need 110 Mb of memory

An A4 page using 65,536 colors at 1200 dpi will need 220 Mb of memory

Compression can be used to decrease the size of these files when they are stored on discThe file is printed at the same resolution as it is shown on

the screen

The file size is very large

A graphic created on the screen using 300 dpi cannot be printed at a higher resolution (e.g., 600 dpi)

Page 29: Http://en.wikipedia.org/wiki/Raster_graphics. Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the

Data compressionReduces the size of bit-mapped files to make them faster to download and take up less disk space / memory

There are a variety of different techniques used to compress filesLossless CompressionNone of the original data is lostMethods are found to store the information in a more efficient way e.g. Instead of 250 white pixels, you store 250 times white pixel (pointing to pixel by address)Example - TIFF

Lossy CompressionThis method involves sacrificing some of the data that our eyes will probably not noticee.g. Instead of using millions of colors we can just use hundreds.Therefore we only use 16 bits rather than 24 bits to represent the color depthExample - JPEG