Your program should follow the steps below: 1. Prompt the user to enter the input PPM file name, the output PPM file name, and one of the following commands to determine what modification should be applied to the input PPM image so that the modified image is stored in the output PPM file: A. "negate" B. "high contrast" C. "gray scale" D. "remove " where is "red", "green", or "blue" 2. Apply the image modification based on the user command. You must define the functions mentioned below to perform the image modification. Note that the original image file should not be changed; the modified image must be stored in the output PPM image file name. Also note that the output file should have the same header lines as the input file. a. negate_image(): accepts the input image file object and the output image file object as arguments. For each pixel element in the input file, it takes the value, subtracts 255 from it and takes the absolute value of the result. This result is written to the output file.

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter9: Sequential Access Files And Menus
Section: Chapter Questions
Problem 1RQ: Which of the following opens the employ.txt file and allows the computer to write new data to the...
icon
Related questions
Question
Your program should follow the steps below:

1. Prompt the user to enter the input PPM file name, the output PPM
file name, and one of the following commands to determine what
modification should be applied to the input PPM image so that the
modified image is stored in the output PPM file:

A. "negate"
B. "high contrast"
C. "gray scale"
D. "remove <color>" where <color> is "red", "green", or "blue"

2. Apply the image modification based on the user command. You must
define the functions mentioned below to perform the image
modification. Note that the original image file should not be changed;
the modified image must be stored in the output PPM image file name.
Also note that the output file should have the same header lines as the
input file.

a. negate_image(): accepts the input image file object and the output
image file object as arguments. For each pixel element in the input file,
it takes the value, subtracts 255 from it and takes the absolute value of
the result. This result is written to the output file.
 
 
 
 
 
 
 
b. high_contrast_image(): accepts the input image file object and the
output image file object as arguments. For each pixel element in the
input file, if the value is higher than 127, set it to 255 or else set it to
zero. This result is written to the output file.

c. gray_scale_image(): accepts the input image file object and the
output image file object as arguments. For each element in a RGB
triplet (consecutive three elements) in the input file, convert its value
to the triplet’s average. The result is written to the output file.

d. remove_red_image(): accepts the input image file object and the
output image file object as arguments. This function sets all red values
to 0 (red is the 1st value in an RGB triple). The result is written to the
output file.

e. remove_green_image(): accepts the input image file object and the
output image file object as arguments. This function sets all green
values to 0 (green is the 2nd value in an RGB triple). The result is written
to the output file.

f. remove_blue_image(): accepts the input image file object and the
output image file object as arguments. This function sets all blue values
to 0 (blue is the 3rd value in an RGB triple). The result is written to the
output file.

3. Test the output of the above functions by displaying the modified
image with a PPM image reader software such as Ifranview.


Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
InputStream
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L