Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The code needs to be in C language NOT C++. Thank you!!! CS 100 Project Five Spring 2018 1. Overview: This program manipulates pictures (image

The code needs to be in C language NOT C++. Thank you!!!

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

CS 100 Project Five Spring 2018 1. Overview: This program manipulates pictures (image files). Specifically, it takes an existing image and creates a new image. This new image can be flipped or rotated or inverted or a simple copy of the original image. 2. Background Information on PPM files Pictures can be stored in many formats. You've probably heard of the more common ones, such as jpeg (from the Joint Photographic Experts Group) and gif (Graphics Interchange Format). The vast majority of these formats store the image data in a binary file. There is one format, ppm (portable pixmap) that uses ASCII files to store an image. These ppm files consist of header information and then a long string of numbers representing the red, green and blue components of each pixel in the image. It is not widely used. Since the images are stored in ASCII, they are much larger than other (binary) formats. However, as these files are (readable) ASCII data, they are a good format for an introductory programming class. The ppm format that is P3 used for this project is width-in-pixels height-in-pixels shown at the right. The maximum-color-value very first line is always P3. pixel-1-1-red pixel-1-1-green pixel-1-1-blue pixel-1-2-red pixel-1-2-green pixel-1-2-blue ... After that, you have three pixel-2-1-red pixel-2-1-green pixel-2-1-blue pixel-2-2-red pixel-2-2-green pixel-2-2-blue ... values (width, height, colors) that can be on a pixel N-1-red pixel-N-1-green pixel-N-1-blue pixel-N-2-red pixel-N-2-green pixel-N-2-blue .... single line or separate lines. Finally, you have the actual RGB values (three integers) for each pixel in the image. A very tiny ppm file that is four pixels wide and six pixels tall, with the top two rows the color red, the middle two rows the color green, and the bottom two rows the color blue, is shown at the right below. P3 This program will be manipulating ppm image files. In order to see if your 4 6 255 program is working properly, you need to be able to view these images. 255 00 255 00 255 00 255 00 Your system might (or might not have a viewer that supports ppm images. 255 00 255 00 255 00 255 00 If not, then download the free program GIMP (GNU Image Manipulation 0 255 0 0 255 0 0 255 0 0 255 0 Program). Download GIMP at http://www.gimp.org/downloads 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 00 255 00 255 00 255 You can use GIMP to convert additional pictures into ppm format for 0 0 255 00 255 00 255 00 255 testing if you wish. Simply load an existing image that you have into GIMP and then select the "Export As" option and a file type of PPM image. Make sure to click ASCII when asked how to export. When you use ppm to convert an image into a ppm file, it puts a comment on the second line. You need to delete that comment line, as our program does not handle comments in ppm files. 3. Project Details: As mentioned previously, this project manipulates image files. The specific manipulations implemented are: 1. duplicate (duplicates / copies an image) 2. invert (negate the image) 3. flipHorizontal (flip the image from left to right) 4. flipVertical (flip the image from top to bottom) 5. rotateLeft (rotate the image counter-clockwise by 90 degrees) 6. rotateRight (rotate the image clockwise by 90 degrees) CS 100 Project Five Spring 2018 1. Overview: This program manipulates pictures (image files). Specifically, it takes an existing image and creates a new image. This new image can be flipped or rotated or inverted or a simple copy of the original image. 2. Background Information on PPM files Pictures can be stored in many formats. You've probably heard of the more common ones, such as jpeg (from the Joint Photographic Experts Group) and gif (Graphics Interchange Format). The vast majority of these formats store the image data in a binary file. There is one format, ppm (portable pixmap) that uses ASCII files to store an image. These ppm files consist of header information and then a long string of numbers representing the red, green and blue components of each pixel in the image. It is not widely used. Since the images are stored in ASCII, they are much larger than other (binary) formats. However, as these files are (readable) ASCII data, they are a good format for an introductory programming class. The ppm format that is P3 used for this project is width-in-pixels height-in-pixels shown at the right. The maximum-color-value very first line is always P3. pixel-1-1-red pixel-1-1-green pixel-1-1-blue pixel-1-2-red pixel-1-2-green pixel-1-2-blue ... After that, you have three pixel-2-1-red pixel-2-1-green pixel-2-1-blue pixel-2-2-red pixel-2-2-green pixel-2-2-blue ... values (width, height, colors) that can be on a pixel N-1-red pixel-N-1-green pixel-N-1-blue pixel-N-2-red pixel-N-2-green pixel-N-2-blue .... single line or separate lines. Finally, you have the actual RGB values (three integers) for each pixel in the image. A very tiny ppm file that is four pixels wide and six pixels tall, with the top two rows the color red, the middle two rows the color green, and the bottom two rows the color blue, is shown at the right below. P3 This program will be manipulating ppm image files. In order to see if your 4 6 255 program is working properly, you need to be able to view these images. 255 00 255 00 255 00 255 00 Your system might (or might not have a viewer that supports ppm images. 255 00 255 00 255 00 255 00 If not, then download the free program GIMP (GNU Image Manipulation 0 255 0 0 255 0 0 255 0 0 255 0 Program). Download GIMP at http://www.gimp.org/downloads 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 00 255 00 255 00 255 You can use GIMP to convert additional pictures into ppm format for 0 0 255 00 255 00 255 00 255 testing if you wish. Simply load an existing image that you have into GIMP and then select the "Export As" option and a file type of PPM image. Make sure to click ASCII when asked how to export. When you use ppm to convert an image into a ppm file, it puts a comment on the second line. You need to delete that comment line, as our program does not handle comments in ppm files. 3. Project Details: As mentioned previously, this project manipulates image files. The specific manipulations implemented are: 1. duplicate (duplicates / copies an image) 2. invert (negate the image) 3. flipHorizontal (flip the image from left to right) 4. flipVertical (flip the image from top to bottom) 5. rotateLeft (rotate the image counter-clockwise by 90 degrees) 6. rotateRight (rotate the image clockwise by 90 degrees)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions