Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

This page removed for FERPA compliance
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Midterm Exam 1 Review Fall 2005: Scaling with input


what does int(.......) do?

int truncates a decimal.
>>>int(3.1)
3
>>>int(10.9999)
10
>>>int(4)
4
etc.

Pixels exist at integer coordinates. The purpose here is to make sure you don't call getPixel at a decimal coordinate. -Student1680

I am jREMOVEDt generally confREMOVEDed about this question?? I'm not exactly sure what the program does????

Try running it. Then open both the pictures in media tools and figure out where these coordinates are. Then when you go back to tracing the code it'll probably be easier to see how it all happened. But be careful: make sure you still know how to trace code effectively without REMOVEDing JES since you won't have JES on the test. -Student1680

I am running this program in JES, and its taking it forever. It didnt take long for scaleAndCrop(.5), but I've been waiting at least 5 mins for scaleAndCrop(1.5) ... Is it supposed to take this long??

The prints are what's killing it. Comment those out and try again. -Student1680

This won't run on my computer. "Note: There is no file at C:\Documents and Settings\Owner\Desktop\JES\food.jpg
makePicture(filename): There is no file at C:\Documents and Settings\Owner\Desktop\JES\food.jpg
An error occurred attempting to pass an argument to a function.
Please check line 3 of C:\Documents and Settings\Owner\My Documents\scaleAndCrop" comes up when I try to run it.

BecaREMOVEDe you didn't download the file and put it in the proper directory. -Student1680

Ok, I'm confREMOVEDed about the sourceX and sourceY purposes in this program but tell me if I got the jist of it: we have a blank image another image. We want to scale the image by some ratio and put it atop the blank image (canvas)...a collage sort of thing?
Source x and source y are where you are copying from. Depending on the ratio you are going to increase the value of source x and source y by a certain number. If the ratio is .5 then you will increase them by 2 becaREMOVEDe 1/.5 equals 2. REMOVEDwever the target x and target y will always increase by 1. -Student2081



Link to this Page