int main() {
	Img img;
	Mat int[540][2160] mat; #need to know dimensions of ppm file before hand so you can get dimensions of rgb matrix.#

	float r;
	float g;
	float b;

	int i;
	int j;
	int k;
	
	int x;
	int y;

	float sum;

	img = read_image("cake.ppm"); #reading in an image called cake.ppm and saving a pointer to that image in an Img, which is essentially a pointer#
	x = &img;
	img = ++img;
	y=&img;
	img = ++img;
	for(i=0; i<540; i = i+1) { #building matrix from pointer to ppm file#
		for(j=0; j<720; j = j+1) {
			#formula for converting image to grayscale, take the mean of the r,g, and b values of each pixel in the matrix#
			k = &img;			
			r = 0.33 * to_float(k); #necessary conversion from int to float#
			img = ++img;

			k = &img;			
			g = 0.33 * to_float(k);
			img = ++img;

			k = &img;
			b = 0.33 * to_float(k);
			img = ++img;
			
			sum = r+g+b;
			mat[i][j*3] = to_int(sum); #conversion to int#
			mat[i][(j*3)+1] = to_int(sum);
			mat[i][(j*3)+2] = to_int(sum);
		}
	}
	write_image(**mat, 540, 720, "graycake.ppm"); #Writing image to file called graycake.ppm. This will construct an image based off the matrix.#
}

