Question: I am trying to code a program in C that will read in a ppm file specified by the command line argument following the name

I am trying to code a program in C that will read in a ppm file specified by the command line argument following the name of the file. I have already completed most of the cases, but I am stuck on shrinking the ppm image to halfits original size. My code for the function is below. I defined the pixels in a typedef struct function /Work on void shrink (pixels_t *image, int x, int y) int i0; FILE *output fopen ("output.ppm", "w"); = fprintf (output, "P6 %d %d 255 ", x, y) fprintf (output, "c,image[i].red_pixel) / 2)) fprintf (output, "%c", ((image [1].bluepixel) / 2)); fprintf (output, "%c", ((image [1].green-pixel) / 2)); I am trying to code a program in C that will read in a ppm file specified by the command line argument following the name of the file. I have already completed most of the cases, but I am stuck on shrinking the ppm image to halfits original size. My code for the function is below. I defined the pixels in a typedef struct function /Work on void shrink (pixels_t *image, int x, int y) int i0; FILE *output fopen ("output.ppm", "w"); = fprintf (output, "P6 %d %d 255 ", x, y) fprintf (output, "c,image[i].red_pixel) / 2)) fprintf (output, "%c", ((image [1].bluepixel) / 2)); fprintf (output, "%c", ((image [1].green-pixel) / 2))
Step by Step Solution
There are 3 Steps involved in it
To shrink a PPM image to half its original size youll need to effectively calculate average colors for blocks of pixels specifically 2x2 blocks to cre... View full answer
Get step-by-step solutions from verified subject matter experts
