Presentation is loading. Please wait.

Presentation is loading. Please wait.

Images 01/29/04 Resources: Yale Web Style Guide The GIF Controversy Unisys - lzw.

Similar presentations


Presentation on theme: "Images 01/29/04 Resources: Yale Web Style Guide The GIF Controversy Unisys - lzw."— Presentation transcript:

1 Images 01/29/04 Resources: Yale Web Style Guide The GIF Controversy Unisys - lzw

2 Image Characteristics  Size  Image Size: Dimension in pixels  Canvas Size: Dimension in inches  Screen Resolution (Pixels per inch)  72 –96 ppi for a monitor  300-1200 ppi for print

3 Image Characteristics  Color  True Color  8 bits per Red, Green, Blue  Or 24 bits per pixel  Given a square image with a dimension of 4 inches and given 2 ppi. What file size would be needed just to store the image data (in bits)?

4 Image Characteristics  Color  True Color  8 bits per Red, Green, Blue  Or 24 bits per pixel  Given a square image with a dimension of 4 inches and given 72 ppi. What file size would be needed just to store the image data (in bits)?  24bits/pixel * 72 pixels/inch * 4 inches/scan line = 6912 bits/scan line  6912 bits/scan line * 72 scan lines/inch * 4 inches = ~ 2000 K

5 Image Characteristics  Given a square image with a dimension of 4 inches and given 300 ppi. What file size would be needed just to store the raw image data (in bits)?

6 Image Characteristics  Given a square image with a dimension of 4 inches and given 300 ppi. What file size would be needed just to store the raw image data (in bits)? 24bits/pixel * 300 pixels/inch * 4 inches/scan line = 28800bits/scan line 28800bits/scan line * 300 scan lines/inch * 4 inches = 34560 K

7 Image Transmission  Most Internet users connect at 56K modems. The download rate for a 56K modem is actually pretty close to 7K.  To transmit ~ 34560 K would take ~one hour  To transmit ~2000K will take ~4.76 minutes  Studies show that users get impatient after a 2 second delay.  Implications?

8 Compression : What is it?  The goal of data compression is to represent an information source (e.g. a data file, a speech signal, an image, or a video signal) as accurately as possible using the fewest number of bits.

9 Image Compression : Web Formats  GIF – lossy for more than 256 colors  For line drawings, gray scale images and color pictures with a palette of 256 colors or fewer  JPG – always lossy  For true color images, especially photographs  PNG - lossless  Not well supported in IE  Replacement format for GIF

10 Compression : How does it work?  Describe the algorithm.  A procedure or formula for solving a problem.  An algorithm can be described in  Pseudocode >An outline of an algorithm, written in a form that can easily be converted into a program. >There are no formatting or syntax rules >Enables the programmer to concentrate on the algorithms without worrying about all the syntactic details of a particular programming language

11 Run Length Encoding  RLE is used in TIFF and PDF files  For a binary image, given the dimensions of the image ( r x c ) and that ( x 0, x 1,..., x( (r*c)-1 ) are image pixels with one of two possible intensity values (0 or 1), the image line can be said to consist of k image segments having length l i.  Assume that the initial image segment has a white value or value of 1.

12 Run Length Encoding Pseudo Code initialize RunColor to 1 initialize RunLength to 0 for each pixel in the image if (pixel is the same as the RunColor) increment RunLength else write RunLength change RunColor to pixel's intensity initialize RunLength to 1 write last RunLength

13 initialize RunColor to 1 initialize RunLength to 0 for each pixel in the image if (pixel is the same as the RunColor) increment RunLength else write RunLength change RunColor to pixel's intensity initialize RunLength to 1 write last RunLength

14 Three Programming Contructs 1. Sequence construct  Statements are executed in the order they're found in the code. X = 3 Y = 2 Z = X * Y

15 Three Programming Contructs (continued) 2. Selection  Controls the flow of execution down one of two or more paths, depending on the result of a logical test.  If – then – [else – then] If (temperature < 50) Wear long pants Else Wear shorts

16 Three Programming Contructs (continued) 2. Selection - Switch Switch (temperature / 10) Case 0: Case 1: Case 2: Case 3: Case 4: Wear long pants break Case 5: Wear zip-offs break Default Wear shorts

17 Three Programming Contructs (continued)  Iteration  A block of code is required to be executed continually until a condition is met  For  While  Pre condition  Do While  Post Condition

18 Lempel Ziv Welch - LZW  Used in GIF, TIFF-LZW, PostScript, Portable Document Format (PDF), V.42bis, compress  U.S. LZW patent (Unisys) expired June 20, 2003.  CompuServe released GIF as a free and open specification in 1987.  … the reading and/or writing of GIF images requires a license to use Unisys patented Lempel Ziv Welch (LZW) data compression and decompression technology … form Unisys

19 LZW  LZW starts with a 4K dictionary, of which entries 0-255 refer to individual bytes, and entries 256- 4095 refer to substrings.  Each time a new code is generated it means a new string has been parsed.  New strings are generated by appending the current character/pixel color K to the end of an existing string w.

20 LZW set w = “” loop read a character/pixel K if wK exists in the table w = wK else output the code for w add wK to the table w = K endloop

21 LZW Input string: /WED/WE/WEE/WEB Character Code New code value input: Output: and associated string: /W / 256 = /W E W 257 = WE D E 258 = ED / D 259 = D/ WE 256 260 = /WE / E 261 = E/ WEE 260 262 = /WEE /W 261 263 = E/W EB 257 264 = WEB B

22 LZW LZW applet


Download ppt "Images 01/29/04 Resources: Yale Web Style Guide The GIF Controversy Unisys - lzw."

Similar presentations


Ads by Google