Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 1040 - Computing with Images1 Image encodings CSC 1040.

Similar presentations


Presentation on theme: "CSC 1040 - Computing with Images1 Image encodings CSC 1040."— Presentation transcript:

1 CSC 1040 - Computing with Images1 Image encodings CSC 1040

2 CSC 1040 - Computing with Images2 Last time: Color basics Additive primaries Start with black background, use a hard edged brush of large diameter and set mode to “Difference” Apply red, green, blue Subtractive primaries Start with white background, use a hard edged brush of large diameter and set mode to “Darken” Apply cyan, yellow, magenta

3 CSC 1040 - Computing with Images3 Color:(108,86,142) Position: (12,9) x = 12 y = 9 red=108green=86blue=142

4 CSC 1040 - Computing with Images4 Today: Pixel encodings Bitmap 1 bit Grayscale 8 bits RGB Color 3 colors: red, green, blue 8 bits/color 24 bits

5 CSC 1040 - Computing with Images5 1 byte = 8 bits How much can we encode in 8 bits? Let’s walk it through. –If we have one bit, we can represent two patterns: 0 and 1. –If we have two bits, we can represent four patterns: 00, 01, 10, and 11. –If we have three bits, we can represent eight patterns: 000, 001, 010, 011, 100, 101, 110, 111

6 CSC 1040 - Computing with Images6 In n bits, we can have 2 n patterns –In 8 bits, we can have 2 8 patterns, or 256 –Values can be encoded as numbers from 0..255

7 CSC 1040 - Computing with Images7 Encoding RGB Each component color (red, green, and blue) is encoded as a single byte Colors go from (0,0,0) to (255,255,255) –If all three components are the same, the color is in greyscale (50,50,50) at (2,2) –(0,0,0) (at position (1,2) in example) is black –(255,255,255) is white

8 CSC 1040 - Computing with Images8 Is that enough? We’re representing color in 24 (3 * 8) bits. –That’s 16,777,216 (2 24 ) possible colors –Our eye can discern millions of colors - so probably pretty close Some graphics systems support 32 bits per pixel –Maybe more pixels for color, or an additional 8 bits to represent 256 levels of translucence Remember: An image that uses 24 bit color is 24 times the size of a bitmap image of the same resolution

9 File Size File size is usually measured in: bits, bytes, etc: Byte = 8 bits Kilobyte = 1024 bytes (= 2 10 bytes) Megabyte = 1024 KB (= 2 10 KB or 2 20 bytes ) Gigabyte = 1024 MB (= 2 10 MB or 2 30 bytes) Terabyte = 1024 GB (= 2 10 GB or 2 40 bytes) … CSC 1040 - Computing with Images9

10 Image size Image size: –Pixels (eg: 300 x 200) –Inches/centimeters (eg: 3 x 2 inches) Resolution: #pixels/inch (eg: 100 pixels/inch) CSC 1040 - Computing with Images10

11 Increasing Image Print Size Image size: –Pixels (eg: 300 x 200) –Inches/centimeters (eg: 3 x 2 inches) CSC 1040 - Computing with Images11 6 x 4 3 x 2

12 Increasing Image Print Size Image size: –Pixels (eg: 300 x 200) –Inches/centimeters (eg: 3 x 2 inches) Resolution: #pixels/inch (eg: 100 pixels/inch) CSC 1040 - Computing with Images12 6 x 4 3 x 2 50 Same pixels, NO Resampling

13 Decreasing Image Print Size Image size: –Pixels (eg: 300 x 200) –Inches/centimeters (eg: 3 x 2 inches) Resolution: #pixels/inch (eg: 100 pixels/inch) CSC 1040 - Computing with Images13 1.5 x 1 3 x 2 200

14 Changing the Number of Pixels (Resampling image) Image size: –Pixels 300 x 200) –Inches/centimeters (eg: 3 x 2 inches) Resolution: #pixels/inch (eg: 100 pixels/inch) CSC 1040 - Computing with Images14 150 x 100 300 x 200 50

15 Photoshop Image Size Menu CSC 1040 - Computing with Images15 Lock aspect ratio Changes the actual pixels Actual pixels Print size

16 CSC 1040 - Computing with Images16 Pixel encodings Bitmap 1 bit Grayscale 8 bits RGB Color 3 colors: red, green, blue 8 bits/color 24 bits

17 CSC 1040 - Computing with Images17 RGB Color File Size RGB color image 24 bits (3 bytes)/pixel Example: Image size: 300 x 200 pixels Total pixels = 300 x 200 pixels = 60,000 pixels File size = 60,000 x 3 bytes (3 bytes/pixel ) = 180,000 …..since there are 1024 bytes/KB: = 175.8 KB

18 CSC 1040 - Computing with Images18 Grayscale File Size Grayscale image 8 bits (1 byte)/pixel Example: Image size: 300 x 200 pixels Total pixels = 300 x 200 pixels = 60,000 pixels File size = 60,000 bytes (1 byte/pixel ) …..since there are 1024 bytes/KB: = 58.6 KB

19 CSC 1040 - Computing with Images19 Bitmap File Size Bitmap image 1 bit/pixel Example: Image size: 300 x 200 pixels Total Pixels = 300 x 200 pixels = 60,000 pixels File size = 60,000 bits (1 bit/pixel ) ….. Since there are 8 bits/byte: File size = 60,000 / 8 bytes = 7500 bytes …..since there are 1024 bytes/KB: = 7.3 KB

20 CSC 1040 - Computing with Images20 Comparing file sizes for 300 x 200 image: Bitmap 1 bit Grayscale 8 bits (1 byte) RGB Color 3 colors: red, green, blue 24 bits (3 bytes) 7.3 KB 58.6 KB 175.8 KB

21 CSC 1040 - Computing with Images21 Type of image Bits/pixel320 x 240 image 640 x 480 image 1024 x 768 image Bitmap 176,800 bits =9,600 bytes =9.375KB 307,200 bits =38,400 =37.5KB 786,432 bits =98,304 bytes =96KB Grayscale 8 (1 byte) 614,400 bits =76,800 bytes =75 KB 2,457,600 bits = 307,200 bytes =300 KB 6291456 bits 786,432 bytes 768 KB RGB color 24 (3 bytes) 225 KB900 KB2,304 KB =2.25 MB 32 bit color (4 bytes) 32 (4 bytes) 300 KB1200 KB3,072 KB = 3 MB Size of images: More Examples

22 CSC 1040 - Computing with Images22 Next Time: Image Compression Goal: Use fewer bytes to encode the same or similar information Reduce redundancy Take advantage of human visual system – don’t bother differentiating things that are unnoticeable Lose unimportant details


Download ppt "CSC 1040 - Computing with Images1 Image encodings CSC 1040."

Similar presentations


Ads by Google