Computer Science 101 Program 3 Due Nov 9 at 11:59 pm Write a complete C program named fade.c that will fade the color of an RGB image (P6) creating another color (P6) image of the SAME size. The fade factor will be specified on the command line. A value of 1.0 should produce a completely gray (but still P6) image. A value of 0.0 should reproduce the original image. For this program the ONLY authorized source of assistance is Dr. Westall. ANY OTHER DISCUSSION of the program no matter how "high level" or "peripheral" (e.g. Have you started/finished it yet?) is STRICTLY FORBIDDEN. Any student who observes improper behavior is encouraged to report it to Dr. Westall. Reports that can be verified will be rewarded with a 20 point bonus on the assignment for the student doing the reporting and an F for the course for the student being reported!! The algorithm should work as follows. For each pixel in the input image convert the pixel to grayscale using the same algorithm as in the last assignment: gray = 0.3 Red + 0.5 Green + 0.2 Blue For example, suppose the values of the three bytes of an input pixel are Red = 240 Green = 128 Blue = 200 Then the gray pixel should have the value: 72 + 64 + 40 = 176 Next the R, G, and B components of the output pixel should be computed as follows: R_out = fade_factor * gs_value(176 above) + (1.0 - fade_factor) * R_input Program operation: As usual your program will read the input image from stdin and write the output image to stdout. It will be invoked with a command line similar to the following: a.out 0.5 < input.ppm > output.ppm The basic algorithm should be as follows: - read ppm header of input image and assign dimensions to variables incols and inrows - malloc space for reading in the input image data - malloc space for building the output image - use a single call to fread to read the input image pixel data - for each row of the output image for each column of the output image using the (r,g,b) components of the input pixel to compute the gray level and then compute the R,G,B components as shown above. store the output pixel values in the output image buffer. - Write the P6 .ppm header for the output image - Use a single call to fwrite to write the output image. ---------------------------------------------------------- Adhere to the following programming standards. Violations will lead to deductions. (1) no function should be longer than 30 lines code + whitespace. (2) the maximum nesting level in any function is ONE (3) code lines should not extend beyond column 72 (4) no more that one statement may be written on a single line (5) use reasonably descriptive names for variables and functions (6) package all functions into a single source code module named fade.c (7) your program should compile without any warnings with gcc -Wall (8) indenting should be consistent with logical nesting (9) diagnostic / debug prints should be disabled/deleted in your submission. (10) For full credit use the struct pix_type in malloc, fread, fwrite, and in accessing individual pixels.