The program reads a PPM image file, alter the RGB elements of each pixel, and prints the resulting image as a new PPM file.
The PPM (or Portable Pix Map) image format is encoded in human-readable ASCII text. The image has two parts:
- Header (metadata)
- Body (pixel values)
The project implements following functionalities:
negate_red
: negates the red number of each pixelnegate_green
: negates the green number of each pixelnegate_blue
: negates the blue number of each pixelflatten_red
: sets the red value to zeroflatten_green
: sets the green value to zeroflatten_blue
: sets the blue value to zeroflip_horizontal
: flips each row horizontallygrey_scale
: sets each pixel value to the average of the threeextreme_contrast
: changes each color number to either the highest color number possible or to 0blur_horizontal
: replaces the values of the red numbers of three adjacent pixels with their averagerandom_noise
: adds a random number to each color number or subtracts a random number
The program has a simple command line interface.
Original Image | Greyscale |
---|---|
Flip Horizontal | Extreme Contrast |
Blur Horizontal | Negate Red |
Flatten RG | Random Noise |
Further details about the project can be found here.