Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 128/ES 228 - Lecture 7b1 File Formats. CS 128/ES 228 - Lecture 7b2 Outline What is an image really? Methods of storing images Compression algorithms.

Similar presentations


Presentation on theme: "CS 128/ES 228 - Lecture 7b1 File Formats. CS 128/ES 228 - Lecture 7b2 Outline What is an image really? Methods of storing images Compression algorithms."— Presentation transcript:

1 CS 128/ES 228 - Lecture 7b1 File Formats

2 CS 128/ES 228 - Lecture 7b2 Outline What is an image really? Methods of storing images Compression algorithms Conversion algorithms In theory In practice

3 CS 128/ES 228 - Lecture 7b3 What is an image? An image is anything we store on the computer that we think of as a “picture”. It should look “the same” on any display. Image file formats GIF, JPEG, TIFF, BMP NOT shapefiles

4 CS 128/ES 228 - Lecture 7b4 File Formats There are many image file formats 35 on the first page I hit looking for a list! Each has advantages and disadvantages

5 CS 128/ES 228 - Lecture 7b5 GIF Developed by Compuserve in 1987 Particularly good for line drawings (anything with sharp edges) VERY common on web

6 CS 128/ES 228 - Lecture 7b6 JPEG (or JPG) Product of the Joint Photographers Experimental Group Good for photos, images with subtle changes Also popular on the web

7 CS 128/ES 228 - Lecture 7b7 GIF vs. JPEG JPEGGIF Use For“Realistic” artworkIllustrations Compre ssion Lossy, but controllable Lossy, no control Colors24-bits8-bits OthersNo transparencyTransparency

8 CS 128/ES 228 - Lecture 7b8 BMP Bitmap format – Windows only? NO Compression means LARGE files Standard Screen Snapshot is BMP

9 CS 128/ES 228 - Lecture 7b9 EPS, PICT, TIFF Encapsulated PostScript (mostly for printing, some display) PICTure format (Macs only) TagInterchageFileFormat (multi- platform, but less used these days

10 CS 128/ES 228 - Lecture 7b10 Shapefiles and active software A running program may read from or write to these formats, but generally uses its own memory management while running. Shapefiles contain shape information and are not in any of these formats – and not truly image files

11 CS 128/ES 228 - Lecture 7b11 Compression Algorithms Compression algorithms “shrink” files May do so by mathematical “tricks” or by discarding information

12 CS 128/ES 228 - Lecture 7b12 Two KEY Facts about Compression NO LOSS-LESS compression algorithm can work all the time! NO LOSSY compression algorithm can regenerate its original data.

13 CS 128/ES 228 - Lecture 7b13 An LOSS-LESS Example Run-length compression Count and record the length of each group of 0’s or 1’s 1110100 1110000 1000000 3 7 0 3 1 1 2 3 4 1 6

14 CS 128/ES 228 - Lecture 7b14 A LOSSY Example Truncation 1242144903 0293570214 9352109521 7259027565 3048282535 124 029 935 725 304

15 CS 128/ES 228 - Lecture 7b15 Converting Vector to Raster Must compute the equation of the line Then choose which pixels to highlight Many algorithms, but differences are technical

16 CS 128/ES 228 - Lecture 7b16 Typical algorithm Y = y0 + 1 Illuminate pixel (x, int(Y)) Y = Y + 1 X = X + 1 /m Illuminate pixel (x, int(Y)) … Until Y == y1 X = x0 Y = y0 Illuminate pixel (x, int(Y)) (x1,y1) (x0,y0)

17 CS 128/ES 228 - Lecture 7b17 Anti-aliasing Basic idea – Remove the “jaggies” by using color variations

18 CS 128/ES 228 - Lecture 7b18 Conversion in practice

19 CS 128/ES 228 - Lecture 7b19 Converting Raster to Vector Basic idea Find areas with sharp changes – these are your boundaries. Adjust as topology indicates Much harder in practice than the other way around Alternative is hand-digitization


Download ppt "CS 128/ES 228 - Lecture 7b1 File Formats. CS 128/ES 228 - Lecture 7b2 Outline What is an image really? Methods of storing images Compression algorithms."

Similar presentations


Ads by Google