CSC151 2007S, Class 34: Storing Images as Simple Pixel Maps * I will continue to reserve time at the start of class for a discussion of campus issues. Admin: * Preregistration is approaching soon. I hope many of you will think about taking CSC161, the next CS course. * Coming not-so-soon to a newspaper near you: Column by SamR * Happy April Fools' Day! (or not). * Raw eggs in shell break when you freeze them. [Farmer, L.A., 2008] Overview: * Files, revisited. * Storing images. * Storing colors. * Storing images, revisited. ==A File is === * Something stored on your computer * Provides permanent storage * We have text files * And lots of other kinds of files * We might want to store images * One technique: Store images through code * Compact but slow * Lots of other techniques that represent the image itself, not the process used to create it * JPG, PNG, GIF, SVG, TIFF, RAW, BMP, ... * Over the next week or so: Design our own representation * What things might we care about as we design a file format for images? * Color range supported (e.g., GIF only supports 256 colors) * Accuracy (e.g., JPG only approximates the image) * File size * What additional information does the file hold? (E.g., layers, comments, encrypted data as in steganography, ...) * Ease of processing (creating, reading back) * Human readability * Responsible design * Should you patent your design? NO * Should you copyright your design? UNAVOIDABLE * SHould you add a creative commons license to your design? YES * Should you pbulish your design so that bozos don't patent it? YES == Writing Lots of Colors == * Use map (map (lambda (color) (rgb-write color out)) (list color-white color-black color-blue color-green color-yellow)) (map (lambda (color) (rgb-write (cname->rgb color) out)) (list "yellow" "white" "black" "green" "blue" "blue" "black"))