CS 101 - Introduction to Computing, Spring 2009

Lab 9

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.

Lab Assignment 9

Due: Thursday 3/19/2009 by 11:59 pm

Create a Java program that will:

  1. Contain a comment indicating

  2. Contain the main() method 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!

  3. Contain a method called cropImage () that will:

    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.

Submittal of the Lab Assignment