C :: Reading PPM Image Into 1D Or 2D Array
Apr 4, 2013I have an assignment where I need to take an assigned image, rotate it 90 degrees to the right, flip it upside down, and turn it to grayscale; each with different outputs.
I was thinking if I can read in the image into a 2d array //array[height][width] or even just an array with the values of each pixel (r, g, b), I can just modify the array and spit it out when done.
if i can just get it into the array, I think I'll be fine. We've done similar assignments with modifying arrays for grayscale images and the other two I can probably figure out. But how am I going to read in each pixel into an array with three different values in each slot? This is my code so far:
Code:
#include<stdio.h>