The objective of this mini-lab is to experiment with the
cropPicturefunctions that we have provided.
Cropping an image means to cut out a certain part of the image
the rest of it. Actually, rather than change the original
cropPicture will create a new picture that
consists only of the desired section, leaving the
original picture unchanged. Cropping is one of the essential
functions in image processing/manipulation. Understanding picture
dimensions (height and width) is an important part of cropping an
copyIntofunctions from the support code functions that we have provided and paste them into the program area in JES. You should also copy and include the comments before the functions. (NOTE: There is a built-in (JES) version of
copyIntothat modifies the canvas and does not do any error-checking on the dimensions of the pictures and the position (upper-left corner) of the picture to be copied. Therefore, we WILL NOT be using the built-in version.)
myPictin these exercises.
littlePic = cropPicture(myPict, 0, 0, 50, 50)
littlePic look like? Which part of
myPict is it?
littleBiggerPic = cropPicture(myPict, 0, 0, getWidth(myPict)/2, getHeight(myPict)/2)
What does this do? Which part of
myPict is it?
myPictin MediaTools -> Picture Tool. Find a section to crop by moving the mouse around over the picture. The
y- coordinates are displayed at the top. Write down the statement you would use to crop this section and save it in a variable. Test that your statement works.
canvasin these exercises.
copyIntofunction to put
littlePicfrom the previous exercises in the upper-left corner of
canvas. Does this modify
littleBiggerPicsomewhere into the middle of
littleBiggerPic, and then
littleBiggerPicsomewhere into an empty canvas. What does your code look like? Write it down.