CPSC170A
Fundamentals of Computer Science II

Lab 18

File I/O

Negative Image

Write a C++ program that reads a binary ppm image and creates a new binary ppm image that is the negative of the image. In a negative image each of the red, green, and blue values are flipped. That is:

0 becomes 255
1 becomes 254
2 becomes 253
.
.
.
254 becomes 1
255 becomes 0

Test the program on a very simple binary image you create yourself. Then test it on larger image you download and convert to a binary ppm using Gimp.