Images are stored by computers in a variety of formats, such as gif, jpg, tiff, and png. These formats differ in how faithfully they represent the original picture, how well they can be compressed to reduce the space each image takes up, or how well they can be copied from on type of computer to another. However, no matter what format the image is stored in, it can always be represented of as a mapping of (x, y) pixel position to a color (the range of colors may be restricted to values of grey or just black and white). Thus, for the remainder of this project, we will refer to all formats of digital images as pixmaps.
This programming project involves manipulating pixmaps by transforming each color in the original pixmap using the same algorithm. Your program will be able to read in gif, jpg, and png image formats, and perform several operations on these images including darkening, inverting, posterizing, coverting it to grey scale. |
For each of the problems below, you will complete the method, transformColor
, that given a Color parameter, returns a new Color whose component values have been changed based on the algorithm described. To test your solution, right-click on the file named pixmap.jar within your project and select Run -> Java Application from the menu that appears. This will cause a Java program to appear that allows you to open, transform, and save images. To test your method on every pixel in the displayed image, click on the button corresponding to the class in which you worked.