copyInto
and cropPicture
functions.
Cropping an image means to cut out a certain part of the image
and discard
the rest of it. Actually, rather than change the original
picture, 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
image.
CropPicture
into your main.py.
myPict
in these exercises.
littlePic = cropPicture(myPict, 0, 0, 50, 50)
What does 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?
myPict
via the openPictureTool
function. Find a
section to crop by moving the mouse around over the picture. The
x
- and 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.
canvas
in
these exercises.
copyInto
function to put
littlePic
from the previous exercises in the upper-left
corner of canvas
. Does this modify canvas
?
littleBiggerPic
somewhere into the
middle of canvas
.
littlePic
into
littleBiggerPic
, and then littleBiggerPic
somewhere into an empty canvas. What does your code look like? Write
it down.
Submit the document containing your typed up answers to the questions on Kit. There is no program file to submit for this mini-lab.