Due Date: 11 May 2011
Here is a simple example of how to write a command line tool:
If you put this into a file and make it executable, you can then say:
Write a command line program that takes as input a PNG file and converts the file to XYZ, L*a*b, and HSV formats and back.
where the argument to -t is one of rgb2xyz, rgb2lab, rgb2hsv, hsv2rgb, lab2rgb, or xyz2rgb
Quantization vs Digitization (20 points)
Write a command line program that takes an input image, a target image size and a target number of quantization levels and rescales the image to that given target size and quantizes it to the given number of levels. For rescaling, use the 'resize' function in the 'Image' object - Python Imaging Library (PIL); you need to figure out the correct parameters to give it in order to obtain reasonable rescaling results.
Compression Ratio (20 points)
Write a Python script that, given a set of image files and an image compression format (and quality, in the case of JPEG), loads each image in turn, compresses it into the given format, and computes the total compression ratio, both from the raw 8 bit per channel image size and the image size of the original input images (which may already be compressed in some format). To solve this problem, you probably need to use the Python Imaging Library (PIL) rather than the imread/imsave functions.