This lab assignment will have you write at least two methods in java that will create a new image that will show a portion from another image. This technique is called cropping.
Cropping of an image is to take a certain part of image and discard the rest of the image. Once the user has picked an image, we shall create an empty image which will store the resulting cropped image. Then we shall copy the pixels from the part of the original to the new image. "Copying the pixels" is nothing but copying the colors of pixels from original image to the new image. We have done cropping during lecture in Lect312c.java.
Create a Java program that will:
Each call will send the image selected but must crop a different section of the image and crop a different sized section image. You are to crop an interesting item from the original image and not just some random location. You will also be required to submit your image with your JES program file. The BlendIn.jpg image offers a few interesting spots that could be cropped. You may use this image or any other image of your choosing. You may wish to use the picture explore() method to help find the x and y coordinates of different interesting sections of an image. Make sure you submit the image with your code when you turn in this program!
This method may call other methods that are in a library or that you have written. Note that the code given in lecture is close to what is needed here but it is not exact. If any of the verify checks fail, print out a good error message and return from the function.
To use the UNIX turnin command to electronically hand-in your html file using the project name of lab9. To submit the files in lab9.java and BlendIn.jpg for lab9, the turnin command is entered as:
turnin -c cs101 -p lab9 lab9.java BlendIn.jpg
To verify what you submitted using the turnin command type:
turnin -c cs101 -p lab9 -v