Question
The Image Manipulation Menu The menu for this program should look as follows: 1. Create an album from directory 2.Read an individual file 3.Display an
The Image Manipulation Menu The menu for this program should look as follows:
1. Create an album from directory
2.Read an individual file
3.Display an image
4.Exit the program
Please enter a number for one of the options given above:
If the user selects to create an album, the program should prompt the user for the location of the directory of the image files. An album in this program refers to all files in a particular directory. Filters will be applied to all images at once. In order to test this functionality, you will need to create multiple files following the PPM file format (a more complex example is provided for you). If the user selects to read an individual file or display an image, the program should prompt for the location of the file. In order to display an image, your program should pop up a window with the image to display (only display a single image at any one time). For options 1 and 2, once the files have been read in, the program should then prompt the user to select from a number of options for manipulating the image.
1.Swap red and blue color values
2.Convert to grayscale
3.Flip the image(s)
4.Flop the image(s)
5.Invert the image(s)
6.Return to main menu
7.Exit the program
Please enter a number for one of the options given above:
If the option selected is 1-5, then the program should prompt for an output location. In the case of an album, this will be directory path for all transformed images. For the individual image file, this will be the file to output to. After the file(s) has been outputted, the program returns to the main menu. The PPM File Format: The basic file format for a ppm image is as follows: Begins with a magic number (P3 for plain ppm) Next value is the width in pixels
This is followed by the height in pixels
Followed by the maximum color value allowed for any red, green, or blue (RGB) value. It is advised that you use 255 for the max color value. This means that each color value is exactly 8 bits in length and will properly map to Javas BufferedImage class.
The remainder of the file is integers where each group of three integers forms an RGB value for a pixel. Pixels are arranged with the first pixel being the one displayed in the top left corner of the image. Each of these values is separated by whitespace (Space, tab, or newline). It is also possible for lines to contain comments. Any line that begins with a # is a comment line.
Filters: There are five types of image filters that you will be creating in this project. The first filter swaps the red and blue color values. The second converts an image to grayscale. The next three are reflections across the different axes:
Flip reflects the image across the x-axis
Flop reflects the image across the y-axis
Invert reflects the image across the x and y axes
The following are a list of requirements that must be handled by your program:
You must create interfaces called ImageReader and ImageWriter. Each interface will contain a single method, either read or write that both take in a single String parameter that represents either a filename or a directory for where image files are stored. Read is used to read data from a file into the Image, while write is used to write data from the Image to the file.
You must create an abstract Image class that implements the ImageReader and ImageWriter interfaces. This class will have an inner Pixel class and a two-dimensional array of Pixels for storing image data. This class will provide methods for getting the dimensions of the array , setting height and width, and getting the pixels in the array (you should be able to refer to a pixel by row and column). This class will not implement the read and write methods. Instead there should be a derived class called PPM that implements these two methods.
You must create an Album class that implements the ImageReader and ImageWriter interfaces. The Album class is responsible for reading in all images in a directory (assume only image files are in the directory), storing the images in an ArrayList, applying filters to all images stored in an Album, and for writing filtered images to an output directory. Writing should not be performed directly, but by calling each Image objects write method.
You must create an interface for filters called Filter. This interface will contain a single method called apply that takes in an Image class and returns an Image class after applying a filter. Each individual filter should be a class that implements this interface.
You must provide functionality for displaying an image using Javas Swing tools and libraries. There is a video that introduces the relevant classes from Swing.
You can add additional functionality to the classes if you find it necessary.
same problem, was incorrectly solved
https://youtu.be/ozB_KEPi4jM video
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started