🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Full Transcript

Quantizing The Image Black and White Images How many colors will we have available to represent each pixel? - Assume for each pixel we have 1 bit to represent the colour - 1 bit can hold either 0 or 1 a) 0 could be white b) 1 could be...

Quantizing The Image Black and White Images How many colors will we have available to represent each pixel? - Assume for each pixel we have 1 bit to represent the colour - 1 bit can hold either 0 or 1 a) 0 could be white b) 1 could be black - 1 bit allows for 2 colours, usually black and white (21 = 2) - 2 bit allows for 4 colours (22 = 4) - 4 bit = 16 shades - 8 bit = 256 shades - MORE BITS → MORE SHADES OF GRAY Subtractive Model - CMYK - Used for printing - Ink applied to paper - Primary colours → cyan, magenta and yellow - Ink when applied removes (subtracts) the white Additive Model - RGB - Use on monitors - “Adding” light to a black background (the monitor) - Primary colors → red, green, and blue How to represent colours on a monitor - True colour a) Can represent 224 colours → about 16 million diff colours b) 224 = 28 x 28 x 28 = (256 shades of red) x (256 shades of green) x (256 of blue) c) Need 3 bytes (remember = 1 byte → 8 bits) for TRUE COLOUR (1 byte red, 1 byte green, 1 byte blue) 2 Ways to Encode True Colours 1. DECIMAL # - Where 0 is no amount and 255 is the most allowed 2. Hexadecimal Code - #RRGGBB → RR are the digit place holders for the amount of red, GG for green, BB for blue - 00 still means 0 - Hex FF = decimal 255 - Hex to decimal: a) 00 = 0 b) 01 = 1 c) 02 = 2 d) “ “ e) 09 = 9 f) 0A = 10 g) 0B = 11 h) 0C = 12 i) 0F = 15 j) 10 = 16 k) 11 = 17 l) “ “ m) FD = 253 n) FE = 254 o) FF = 255 RGB → Hex → #000000 → #090807 → #0A0F09 → #FF00FF → #420063 ➔ The human eye can detect a maximum of about 10 million colours ➔ You can represent the same number of colours using Hex as RGB Indexed Colour Images Sometimes we don't need 16 million, that’s why we use indexed colour (an index that maps to a group of colours we plan to use) What types of images don't need a full palette of colours? - Clip art - Cartoon type image Our index might be 8 bits → = 256 colours (2^8) Called Image Bit Depth (ex: “8 bit depth”): The number of bits used to represent each pixel in an image. We only index the colours we need (if we will never use purple in our image, don’t need to include it in the index of colours) Indexed colour can look pretty good even though we will only ever have at most 8 bit colour (or 256 shades of colour) Bitmapped vs Vector Graphic Images Bitmapped Graphic Image - Image consists of pixels in a grid - Icons are an example of a bitmapped image (ex: firefox icon of the fox wrapped around the earth). Icons are usually 32 pixels by 32 pixels - When bitmapped images are enlarged (resampled) the computer adds new pixels and guesses on the colour to colour the pixels (this is called Interpolation: inbetweening, or filling in frames between the key frames) based on surrounding pixels - This icon is now 245 pixels by 245 pixels - Bitmapped images’ edges become jagged Bitmapped Images - Also called “raster graphics” image - Bitmapped images are resolution dependent a) Bitmapped image on a 640 by 480 screen (lower res.) appear larger than on a 1280 by 1024 screen (higher resolution) - Bitmapped images that are enlarged: a) Have a larger file size than original b) Become distorted - All images from scanners and digital cameras are bitmapped images Common Bitmap File Formats - BMP (has little compression, makes big files!) - GIF - JPEG, JPG - PNG - PICT - PCX - TIFF Vector Graphic Image - Vector image is made up of individual, scalable objects - Objects are defined by mathematical equations - Objects consist of lines, curves, and shapes - No distortion as image is enlarged - As image is enlarged, still has crisp clean lines - Most browsers don't display vector graphics without a plug in - Only can be used with drawings, NOT PHOTOGRAPHS - Usually vector graphic image has a smaller file size than the same image stored as a bitmap - Vector images are great for logos because a) Can be scaled down for business card b) Can be scaled up for trade show poster You can convert a Vector Graphic Image into a Bitmapped Image EASILY but you CANNOT easily convert a Bitmapped Image into a Vector Graphic Image. Image File Size How big is an image? - How many bytes one large picture in true colour (224 colours) would take up; Roughly: - Total number of pixels (sampling) x Colour Bit Depth (quantizing) - Length (px) x width (px) x colour bit depth (bytes) Example: - Assume we have a picture that is: → 1600 pixels by 1200 pixels Each pixel will need 3 bytes (8 bits red, 8 blue, 8 green) How many bytes, kilobyte, and megabytes is the image? - 1600 x 1200 x 3 = 5,760,000 bytes - 5,760,000/1024 = 5625 kilobyte - 5625/1024 = 5.5 megabytes UNITS OF MEASURE 1 kb = 1024 B 1 Mb = 1024 KB 1 Gb = 1024 MB 1 TB = 1024 GB Divide by 1000 for these conversions *** extension.raw = uncompressed image For printing in a flyer or magazine - File size doesn't matter - Most important issue is quality of image - Image will be printed with at least 300 dpi For displaying in a webpage - File size is very important - Bigger files take longer to download - Quality is important too but want to try to get best quality with smallest file size Compressing File Size (size it down - pixels) - How do we download faster? Make our image file size smaller! Option 1 Make the image be physically smaller (LESS PIXELS) but that will change the size it is displayed at on the screen - For example: an 100 pixel by 100 pixel image (30kb) is smaller than a 200 pixel by 200 pixel image (118kb) Option 2 Compress the image file. Use tricks to make file smaller without losing the quality of the image or the size (in pixels of the image) (still 200 by 200 pixels but file size is smaller) An uncompressed image that is: - 200 by 200 pixels - True Colour (16 million colours → ) - Will be 200 x 200 x 3 bytes = 120, 000 bytes - Will be 120, 000/1024 - = 117.2 kilobytes

Use Quizgecko on...
Browser
Browser