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

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Fall 2004 Homework 5 Questions

MOVIEMAKERS! Got questions on how to make movies? Ask 'em here!

Hey there Mac users!
Some OSX users have had trouble running the moviemaker program. Here's a quick step-by-step run-down:

Steve Voida

Although it is not a question, I still would like to tell you guys that I love making movies, especially Japanese animations!

How do you know what pictures we use in the func? wouldnt we need to pass pictures also as an argument? Like would we use getMediaPath() or pickAFile()?


Can you explain what does MIDWAY mean, is it like the ticker tape?

How do we change fps?
Moviemaker will ask you for the fps you desire.Bill Leahy


Can our third picture be ticker tape, even if we already have used a rectangle?

1. The images will either be turned in by you or created in the program (in the case of the drawn image like a rectangle or arc). So the images that are jpg files will be stored in a folder that is the directory called in the input, so yes you probably will need to getMediaPath for that picture. 2. Midway just means that the image that is the midway image won't appear at the beginning of the movie–it will appear midway (halfway) through the movie. 3. You determine the frame rate when you actually create your movie in the movie maker. 4. In the past the third image has been allowed to be a tickertape, so I would imagine that is fine again this year, but if a professor has a different answer to that, please correct me! Summer McWilliams

How do we actually make the movie? I have all of my JPEGs done. The book says to run the MovieMaker tool that came with the CD, but when I do that all I get is a dos prompt.

Ok, I see that it opens in another window, but now I am getting a java.lang.outOfMemoryError. I only have 512mb, but that should be enough. I mean how many people are really running a GB of ram?

Try downloading the version that is on the class webpage: http://coweb.cc.gatech.edu/cs1315/847 and use thatBill Leahy


Are we allowed to have two ticker tapes? One for the second requirement and one for the third


This sounds like a HW6 question but this is the HW5 questions page?Bill Leahy


No, I meant are we allowed to pieces text to be in motion, for the second and third requirements?
Sure, after all it says that text is allowed doesn't it? ;)Bill Leahy

Do we use getMediaPath to get our pictures, so the graders of this lab would have to setMediaPath???
That would be a good idea.Bill Leahy

Is there way to make the color of text different in addText?

Is there a way to get the text bigger?
Near the end of the slides for tomorrows (11/8) lecture there are some techniques for changing size, color and style of text. Check those out.Bill Leahy

Whenever I copy and image to the background, there is always a blank rectangle instead of the actual pic

Double check your code. Sometimes if you forget to increment an index this will happen. It's like you copy the same pixel to every pixel of the destination.Bill Leahy


No, I meant are we allowed to pieces text to be in motion, for the second and third requirements?

BUT THE SECOND REQUIREMENT SAYS "one drawn image (a rectangle or line or text or oval or arc – anything that you draw)" IT INCLUDES TEXT SO ARE WE ALLOWED TO OR ARE WE NOT TO HAVE TEXT FOR THE SECOND REQUIREMENT???
Of course you are allowed text if it says text. What could be clearer? ;)Bill Leahy

where is the movemake application on the cd?
I would recommend that you download a fresh copy from the web page: http://coweb.cc.gatech.edu/cs1315/847

Can someone give the explicit way to make a movie because I've been trying for a long time and I can't figure out how to do it?
Make a bunch of jpegs each of which represents a frame. Use moviemaker software to turn it into a movie. For more details, see lecture, breakout, textbook.Bill Leahy


I don't think I'm grasping the assignment. Hypothetically speaking, can we have a rectangle moving down barb, a ticker tape going across a flower pic, and then another image that has another jpg copied on top of it? I suppose I'm not understanding the whole concept. Are all of these things occuring simultaneously (w/the exception of the midway pic) on top of another image; or will it be the rectangle motion followed by the tickertape, followed by the scaled-&-copied-within-another pic - or all those three things appearing on top of a blank screen?

I think that you are making it more complex than it needs to be. The basic idea is to have the three things listed moving around on top of some picture more or less simultaneously (with exception of the midway picture as you have mentioned.)Bill Leahy

For the scaled image: is the scaled image to be moving on the background pic - or does it need to be scaled, copied into another pic, and then moving on the background?

You have to have an image moving and it has to be moving on a background image. So in principle you can just copy the small image onto the big image. If the small image is too big for what you are trying to do you can scale it and make it smaller.Bill Leahy

can we ask our TA to setMediaPath() to the file that we send our pictures to them in?

Yes. That question was already answered on top of this page.Bill Leahy

So, I was told by a very reliable source that HW5 was not due until Monday November 15,2004. True or False?

Yes, we are going to extend HW5 until Monday because some of the material in Friday's lectures would be useful to some of you fledgling Steven Speilbergs.Bill Leahy

i downloaded the version of Movie Maker from the class website but when i try to run it i get this message:java.lang.OutOfMemoryError. I guess someone already had that problem earlier but he was asked to download the version from the book. Well, i did it already but it's not working. Any suggestions???

For a start, reboot your machine and try running just moviemaker and no other programs. Also, just out of curiosity how much memory do you have?Bill Leahy

Is 75 frames the maximum number of frames that we can have or can we have more???
You can have moreBill Leahy

Do you want us to turn in any frames at all?
No.Bill Leahy


so, in theory, what is happening is that the code is creating, say 100 frames (100 different jpegs) and then that cannot actually be seen as a movie until we run and save it with the moviemaker? does this mean that our TAs will use the code to create the pictures and then run and save it with the moviemaker in order to grade it as a movie?
Yes, that is what is happening, and this is how your TA will grade your assignment. Kelly Lyons

You can also see the movie (while it's still a bunch of frames) using the MediaTools Application (p. 293). This doesn't require QuickTime or Java, so it runs even when MovieMaker doesn't. Mark Guzdial


The bike movie on the Fall2004 Homework 5 movies page ROCKS! Great job! Mark Guzdial

I only have 256MB of ram and no matter what I do (I've read the page and done everything suggested) I still get the OutOfMemory error. Why am I required to run a program in a 1000 level class that is too big for my computer to handle??

You are not required to run this program for the class. You can do the assignment fully without using moviemaker. Try getting a friend who has moviemaker working on their computer to make your movie for you so that you can see it. Kelly Lyons
See the this page for the minimum recommended system requirements for the Student Computer Ownership program. Missing Page

For the jpeg requirement: If I want to put the whole jpeg into the movie (it's quite small) do I still have to use a version of the copy function that shrinks barbs head and puts it on the page? Or is there a way I can call on it like addRectangle wherein I simply specify the x and y coordinates?

You can write a simple function that will just copy the small picture onto a large picture without scalingBill Leahy

I know the function addRectFilled adds a colored rectangle. However I looked in the book for a circle function (I want to draw a circle...), and the only one I can find is a method called addOval on p347, which JES is not recognizing. Is there a way for me to draw a circle?

addOval works fine for me. You are calling it like a method and not a function aren't you?Bill Leahy

I think so->
canvas.addOvalFilled(color,x,y,width,height)
Am I missing something?

I thought you wanted a circle? Try addOval without the "filled"Bill Leahy


I got nothin'. Rectangles will work well enough for this time. Thanks, though.

Okay, but feel free to stop by during office hours and we can look at it.Bill Leahy


JES is not accepting any of the pictures that I want to use! It says that it was unable to load the image nad to make sure that it is a valid image file. I am only trying to test my function. I can't get past this simple part..

this is somewhat of a general question. How does one use the words "and" and "or" for "if" statements? in other words, why isn't this working:

if frame >10 and <111:


Try this: 10 < frame < 111 Bill Leahy

I fixed the picture problem. It is accepting them now!


Or do frame > 10 and frame < 11 Mark Guzdial


Every time I try opening the movie using openMovie(pickAFile()) in JES i get an error that says java.lang.NoClassDefFoundError has occured. how can i fix that so i can see the movie?
openMovie() requires you to have QuickTime and Java for QuickTime installed on your computer. When you install QuickTime, there will be an option to also install Java for QuickTime. Download it here: http://www.apple.com/quicktime Greg Leo

Is it okay to have two of the 3 ojects come in later, rather than 2 starting at the beginning?

yes Kelly Lyons

Whenever I have code that looks something like this:
     framenum=str(frame)
     if frame < 10:
         writePictureTo(canvas,directory+"//frame0"+framenum+".jpg")
     if frame >= 10:
         writePictureTo(canvas,directory+"//frame"+framenum+".jpg")

Then it give me the error message:

An attempt was made to call a function with a parameter of an invalid type. This means that you did something such as trying to pass a string to a method that is expecting an integer.
in file C:\Documents and Settings\Me\My Documents\AlreadyBackedUp\CS 1315\Homework 5\makeMovie.py, on line 47, in function tickertape
TypeError: __add__ nor __radd__ defined for these operands

Why would it be doing this?

Questions: Is your code really indented like that? Which line is line 47? Bill Leahy
Hm. This sounds like a similar problem to the one we had on the midterm exam #2. writePictureTo expects two parameters: (1) a Picture object, and (2) a string. You're okay with the Picture object, but you don't quite have a string on the right-hand side. Here's a hint: the + operator means different things depending on what kind of variables are around it...sometimes it means addition and other times it means concatenation.Steve Voida

If you can't use the openMovie function, you don't have QuickTime for Java installed. You need to install QuickTime from http://www.apple.com/quicktime. (It's free.) As you go through the installation process, you'll see an "Options" button. Click that, and be sure to check QuickTime for Java. Mark Guzdial


on the above code it is indented with the if statements in line with the "framnum" line. Where I am getting the error message is at the "writePictureTo" line.
Try printing out the value of all the variables in the line causing the problem (just before you get to that line.) i.e. canvas, directory and framenumBill Leahy

can i change the background jpeg image halfway through the movie? i have fulfulled the other requirements, but can i just change the background?
Yes, that seems like it would be okay.Bill Leahy

the addOvalFilled() function isn't working. It won't turn blue and it returns an error saying that I need to define a variable before i use it in any way... help! ashley myhal

Can someone give me a hint as to how I can have something appear in the middle of the movie? Does it have to do with how we write out the frames for that particular part? (ie the sequence of things) - or am I way off?
If you have a for loop variable (e.g. framenum) you can test it inside the loop and only have it do something when the value of framenum is greater than some value.Bill Leahy

I am having the same problem as the person above who got the "TypeError: __add__ nor __radd__ defined for these operands" error. The reason I consider this a problem is, not only am I getting it when it tries to right the pictures to the directory using my own code, but I am also getting this when I try to run the movingRectangle function from the slides from class on 10-20-04. I feel like my code should work, aside from this error, and I was certain that the course's code should have worked, so this is troubling. I would appreciate any help and suggestions.
When you call the function what are you passing in? It works fine for me. Are you calling it with something like: movingRectangle('C:\\TEMP')Bill Leahy

Ok, I got the rectangle function to work that way. I tried to do the same exact thing with my function, and it still gives me that error. I even copied and pasted the frame writing commands from the rectangle function. I don't know what else to try to fix it at this point. Any other suggestions? (I tried the print statements) Thanks.

Check for a hint five or six questions up on this page...this is a very common (and subtle) problem.Steve Voida

For the subfunctions within the makeMovie function, does the code need to just be incorporated w/in the makeMovie function, or simply called within it & defined after; also, for the subfunctions - do each of those frames need to be written out in each separate function, or when we write them out in the end of the makeMovie function does that take care of it?
You need to write each frame out just once.Bill Leahy

When I use movie maker, I input the starting and ending frame, set the frame rate, and name my movie name.mov....then nothing happens. The DOS like program runs and says unknown source beside everything...any help?
So, the frames are all valid .jpg files? i.e.you can look at them and they open properly when you double click on them?Bill Leahy


I'm kind of having the same problem. I've been trying to view my movie in MovieMaker after I've finished and run my code, but it gives me all this nonsense about javax and unknown source.
Nonsense to you–pearls of information to trained professionals...i.e. could you maybe copy/paste some of these messages her for us to see?Bill Leahy

I also have to extract the files everytime I want to use MovieMaker.
What exactly do you mean?Bill Leahy

what determines the # of frames we have? do we decide that based on how long & the speed?
Well, you need to have an animation that is at least 3 seconds long so you take your frame rate times the number of seconds and this will give you the number of frames. So, in your program you will typically have a for loop which will loop once for each frame and this is what determines how many frames you will get. i.e. range(1, numberofframesthatyouwant+1)Bill Leahy

so for the image that must be copied into the frames, that is not REQUIRED to be scaled down or anyhting special like that, it just has to be copied in rather than drawn or something, right?
Right!Bill Leahy

to the person with the oval problem, you can call it like a method and it will work...i'm using it in that form in my movie becaus ei couldn't get it to work as a function either.
Exactly right. It isn't a function. It's a method. There are lots more methods that there are functions so it is worthwhile to learn about objects and methods. This will open up your world to exciting new possibilities!Bill Leahy


So what all do we need to turn in exactly?? just the program and the pictures used to make it work?? Or frames Or frames and the movie?

The program and your source images. No frames. No movie.Steve Voida

how can i make the tickertape font white, because my background is black so i cannot see it.

Good question (but one that just happened to be answered during lecture). Try looking on the lecture slides entitled 'objects-with-Joe'Steve Voida

yea, but i was hoping to not have to use the object-oriented programming. thanks anyways, i found a way around it.

so far, I have tried to run 2 different tickertape functions (each at different positions) within makeMovie, but when I play it in QuickTime it only shows me the last (second) tickertape function...why can't I get them both to work at the same time?

When you look at the individual images what do you see?Bill Leahy

So, we can use tickertape as one of the requirements?
I'm not sure what you mean by that?Bill Leahy

Is it okay if we use photos cropped somewhere else instead of scaling them in JES?
Sure. You just need to supply us with the photos your JES program will use.Bill Leahy

i don't get this at all. i am just trying to test out how to run a movie program,i cut and pasted the simple rectangle code from the lecture slides and i set the media path and then i try to run it with this as my directory(C:\Documents and Settings\Valued customer\My Documents) and it always says Your code contains at least one syntax error, meaning it is not legal jython. why? i just need to know how to get all the frames into a folder so i can then use them in movie maker

Not quite enough information to go on. Email me: bleahy@cc.gatech.eduBill Leahy


When I try to run my movie using openMovie(pickAFile()) it get
I wasn't able to do what you wanted.
The error java.lang.NoClassDefFoundError has occured
in file C:\JES\Sources\media.py, on line 1044, in function openMovie
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError
Can someone please tell me what i'm doing wrong?

This means JES can't find Quicktime for Java. Try installing the latest version of JES from the course software page. Missing Page


what does UnboundLocalError: local: 'framenum' mean?

the area higlighted in my program is :
picture=makePicture("frame"+int(framenum)+".jpg")

You dont't want int instead you want strBill Leahy

i am having an odd problem. i am using the printNow function to be able to see what's going on with some of my frames, my range is (50,100) and the frames look like what they are suppossed to when i look at them individually. but after the it prints the last frame 99, it jumps back down to 50 and then proceeds back to 99, then back down to 50 and so on...so my program never finishes, but i have the frames i want. how do i stop this process?
How many for loops do you have? Perhaps you have code nested in multiple for loops that is causing this to happen. You probably ought to get with me or a TA via email, IM or in person and let us take a look at your code.Bill Leahy

When I use the code below, I get errors when I try to run it. I have tried multiple solutions and none work, is there another phrase I can use? Could it be because I am using a mac?
if num < 10:
     writePictureTo(framepict,directory+"//frame0"+framenum+".jpg")
if num >= 10:
     writePictureTo(framepict,directory+"//frame"+framenum+".jpg")

Assuming that you have the indentation as it is above... If your framenum is a number you need to convert it to a string using the str function.Bill Leahy

Does a tickertape qualify as one of the three motion requirements?

Sure. Of course it will be better if it relates thematically.Bill Leahy

I'm running an example of the two rectangles moving from the book to warmup as practice before i run my own movie, yet when i play it in moviemaker, when i create the file (after choosing beginning and ending files) the black DOS window says java.lang.OutOfMemoryError. i've had this computer since the beginning of the semester, i don't think i have no memory left to run a simple movie!
Get a new copy of moviemaker from the class website.Bill Leahy

Won't the TA's have to set their media paths to mediasources & use the pics we used in order to see what we made? Will they make a directory w/our pics & input that directory?
The TA's will set the mediapath to where your pictures are and pass in the ouitput directory to your function. You just turn in your code and your source pictures (not your movie). Make sure you read in all pictures using getMediaPath and that your function takes in the output directory.Bill Leahy

I have the code below:
framenum = str(frame)
if frame 10:
writePictureTo(canvas,directory+"//frame0"+framenum+".jpg")
if frame >= 10:
writePictureTo(canvas,directory+"//frame"+framenum+".jpg")
I ran the program with 2 of the 3 required images, it worked, and i made a movie. i tried to add tickertape, got an error message. i took that out, using the original code i made the movie with. i now get this error:
Frame number: 1
writePictureTo(pict,filename): Path is not valid
An error occurred attempting to pass an argument to a function.
in file D:\BC Word\CS 1315\bowden's code\makeMovie.py, on line 26, in function makeMovie
in file C:\Documents and Settings\Steven\Desktop\JES\Sources\media.py, on line 909, in function writePictureTo
ValueError:
Please check line 26 of D:\BC Word\CS 1315\bowden's code\makeMovie.py
it worked once, why won't it work now?
Are you passing in a valid value for directory? For example if you pass in a path name that ends in slashes you will get this error.Bill Leahy

My code is completely fine and it keeps telling me that it has a syntax error. I believe it might have something to do with the way i am calling it from the command area. Is it right to setMediaPath() with the file that contains your pictures, and then input makeMovie("pathname") with the same pathname you used for setMediaPath?
Yes.Bill Leahy

Does the composited image have to be in motion? For instance, if I used my composited image as the background, then had three objects moving (maybe 2 tickertapes and a drawn image), would that meet the requirements?
No, you have to have just some picture as the background. then for each frame you have to copy another image onto it and have it move from frame to frame.Bill Leahy



i still cannot get my code to run without errors. I used the move barb head fuction in the book and i get an out of bounds error on the setColor line pertaining to targetX and targetY. Since the code in the book was scaled down by 2 i took the /2 out and i'm not sure what the 3 is for but my code looks like this. Why is the target wrong? 60x56 is the size of my picture.
def func1(frame,canvas):
runnerf=getMediaPath("runner.jpg")
runner=makePicture(runnerf)
sourceX = 1
for targetX in range(frame,frame+getWidth(runner)):
sourceY = 1
for targetY in range(frame,frame+getHeight(runner)):
color = getColor(getPixel(runner,int(sourceX),int(sourceY)))
setColor(getPixel(canvas,targetX,targetY), color)
sourceY = sourceY + 2
sourceX = sourceX + 2
What size is your canvas and what size is the picture you are putting on the canvas? How many frames are you making? Do you have any idea on what frame it is occurring?Bill Leahy

TypeError: __sub__ nor __rsub__ defined for these operands

(

I keep getting this error:

>>>hw5(r'C:\Documents and Settings\SC036\Desktop')
Frame number: 1
I wasn't able to do what you wanted.
The error java.lang.ArrayIndexOutOfBoundsException has occured
Please check line 10 of C:\Documents and Settings\SC036\My Documents\makeMovie.py

What does this mean and how can I correct this?
In Line 10 you are probably trying to access a pixel of a picture which is not actually in the picture.Bill Leahy

I went to unzip a fresh copy of MovieMaker to get rid of the pesky Out.Of.Memory.Error business, but when i double-click on the MovieMaker.exe icon in winzip, a split second flash of the black DOS window pops up and then disappears...that's it. I don't have a chance to open starting/ending files or anything. I tried extracting it to some folder and open it from there, but the same thing happens. So i've been sitting here for the past few hours with 100 frames of awesomeness that can't be made into a movie (or at least viewed as a movie).
On page 293 of the textbook it mentions a tool on the CD called MediaTools which could let you look at the frames as a movie (without making a movie.) You can also download a tool called IrfanView (www.irfanview.com) which will allow you to view images rapidly enough to see if your movie looks right. And don't forget, you don't have to turn in a movie. Just the program and the original source pictures.Bill Leahy

the following code doesn't work:
if frame > 50:
            addRectFilled(canvas, frame+300, frame10+100, 50, 50, red)

Is there something small I am missing or am I going about that completely the wrong way. If it's the latter, any hints??

What error are you getting? How big is your canvas? What is the value of frame when the error occurs? You can do a: printNow(frame) just before the addRectFilled statement to have JES print out the frame number each time through the loop.Bill Leahy



i had the question 4 lines ago and it does not specify a frame, the background canvas is 500x305, runner is 60x56, and i am making frames in range (0,100). If i change the 0 to a 1 it gives me an error in the line before referring to sourcex and sourceY as an out of bounds error.



i added in a printNow and the error comes up in frame 1. I changed the range to (1, 100) and now i get an out of bounds error where color=getColor....
def testMovie():
  setMediaPath()
  for frame in range(1,100):
    canvas=  makePicture(getMediaPath("fenway.jpg"))
    canvas = func1(frame, canvas)
    canvas = func2(frame, canvas)
    
def func1(frame,canvas):  
  runnerf=getMediaPath("runner.jpg")
  runner=makePicture(runnerf)
  for frame in range(1,100):
    printNow("Frame number:"+str(frame))
    canvas=makePicture(getMediaPath("fenway.jpg"))
    sourceX = 1
    for targetX in range(frame,frame+getWidth(runner)):
      sourceY = 1
      for targetY in range(frame,frame+getHeight(runner)):
        color = getColor(getPixel(runner,int(sourceX),int(sourceY)))
        setColor(getPixel(canvas,targetX,targetY), color)
        sourceY = sourceY + 2
      sourceX = sourceX + 2


First problem: Get rid of the "canvas =" in testMovie (both places) just call the function. Second problem: Your function is going to make the pictures half size. So you need the ranges to go more like: range(frame,frame+getWidth(runner)/2). So if your source picture is 100 pixels wide and you are going to make the target go from 1 to 50 and the source goes in steps of 2. Same for getHeight...divide it by 2.Bill Leahy

i finally got my code to work and the tickertape works, but neither of the two pictures show up. What's wrong?


How are the TAs going to know at what "FPS" to build the movie?

I suppose you could tell them but if you don't they could probably use whatever they wanted to know if your program works or not.Bill Leahy

ok, my program runs, but when it is time for my tickertape to show up(frame30), my pictures disappear. and once the end of my tickertape string goes past the left end of the canvas, the sting doesn't begin again on the right side. is it supposed to continue, and why are my pics dissappearing?

Well, it probably has to do with the way your program is written. Do you have 1 loop for the frame number or multiple loops? If you are creating a new picture everytime (which is normal) are you continuing to copy the pictures onto it even after frame 30?Bill Leahy

how would i be able to check if i was copying the pics after frame 30?
Examining your code.Bill Leahy


ok, maybe I'm missing something, but what exactly do I input for "directory?" C:/JES/HW5/makeMovie.py, C:/JES/HW5?? I am also getting an error: I wasn't able to do what you wanted. The error java.lang.ArrayIndexOutOfBoundsException has occured. It is highlighting the line: color=getColor(getPixel(platform,int(sourceX),int(sourceY))). Is this something to do with copying the pixels??

ah. disregard the above rambling. i've actually figured it out! and it actually worked! amazed

GoodBill Leahy

Why won't my pictures show up on my background?
Gosh, it could be lots of reasons. You need to get with someone or give us more information.Bill Leahy

ok, i got the program to run and everything. i get the out of memory error when i try to run movie maker. that shouldn't affect the grading of my movie when the TA's do it, correct?
CorrectBill Leahy

I'm having problems with the writePicturesTo stuff. It says that it's expecting one thing and I'm giving it something else (just like the problems other people have mentioned above). I've used str(num) and looked everywhere else for help, but no good news yet.What am I doing incorrectly?
It would really help if you would post the error messageBill Leahy


Is it all right if our functions create more than one folder of frames? My main one calls 3 baby ones that each do something to the frames, but since each one uses the input of the one before, it writes more than one folder.
No, you should only be writing files to one directory. That is part of the assignment requirements.Bill Leahy

when you excute the code what should the directory look like for a Mac? I know to just pick where I want the frames to go, but what format does the directory go in? makeMovie(/Users/Name/JES Folder/)?

sourceX = 1
for targetX in range(frame3,frame3+((4-1)/2)):
sourceY = 1
for targetY in range(frame3,frame3+((4-1)/2)):
color = getColor(getPixel(ken,int(sourceX),int(sourceY)))
setColor(getPixel(canvas,targetX,targetY), color)
sourceY = sourceY + 2
sourceX = sourceX + 2
sourceX = 1

This is some code for one of my pics that won't show up. Any suggestions?

Just to let you know something crazy happened with the link there

This is the code I took straight from the book–


def writeFrame(num,directory,framepict):
# Have to deal with single digit vs. double digit frame numbers differently
framenum=str(num)
if num 10:
writePictureTo(framepict,directory+"//frame0"+framenum+".jpg")
if num >= 10:
writePictureTo(framepict,directory+"//frame"+framenum+".jpg")



But when I try to get the program to work is gives me this–
An attempt was made to call a function with a parameter of an invalid type. This means that you did something such as trying to pass a string to a method that is expecting an integer. This problem is referring to the first writePictureTo. I have the str(num) what am I doing wrong?


I ran my program before and it worked perfectly.. I haven't touched it since I ran it last. I tried to run it just to double check before I turned it in and I am having the same problems as some of the people above. I have this line of code...

def writeFrame(num,directory,framepict):
framenum=str(num)
if num 10:
(29)writePictureTo(framepict,directory+"//frame0"+framenum+".jpg")
if num >= 10:
writePictureTo(framepict,directory+"//frame"+framenum+".jpg")

and I get an error message as this...
An attempt was made to call a function with a parameter of an invalid type. This means that you did something such as trying to pass a string to a method that is expecting an integer.
in file A:\cshw5, on line 22, in function makeMovie
in file A:\cshw5, on line 29, in function writeFrame
TypeError: __add__ nor __radd__ defined for these operands
Please check line 29 of A:\cshw5
>>>
I labled my line 29 in my code it is indented right I know it is one space off but thats just because I labled it.. Basically I am very confused I have been trying to fix this and I read the questions from other people and I still don't know what to do. I know it is a small thing but I have been trying to figure it out for about an hour now and I just need help PLEASE!


I'm having these same problems and I don't know what to do!

I'm having the same problem. HELP!

sourceX = 45
for targetX in range(frame3,frame3+((200-45)/2)):
sourceY = 25
for targetY in range(frame3,frame3+((200-25)/2)):
<12>color = getColor(getPixel(tiger,int(sourceX),int(sourceY)))
setColor(getPixel(canvas,targetX,targetY), color)
sourceY = sourceY + 2
sourceX = sourceX + 2

my code for the moving jpg image is getting an error on line 12 (labled) saying: "I wasn't able to do what you wanted.
The error java.lang.ArrayIndexOutOfBoundsException has occured
Please check line 12 of C:\Documents and Settings\Laura Elkins\My Documents\Hw5"

how can I make the background of my images transparent on my movie?

Laura, im not a TA but you are using the numbers out of the book which pertained to Barb's head. if you prescaled your pictures you can use getWidth and getHeight for your target inputs instead of (200-25). also you can change the 45 and 25 to say 1, 1 depending where you want the picture to start in the first frame.

basically you are telling the program to put a picture off of the background image you have created. Look at the size of YOUR pictures, not barb's

Thanks y'all are great

Does anyone know how to make one of the pictures start lower than the other. I want this image to start at 200 pixels in Y direction. it is only 56 pixels tall and the background is 305 pixels tall. here is the code:

for frame in range(1, 100):
canvas=makePicture(getMediaPath("fenway.jpg"))
runner=makePicture(getMediaPath("runner.jpg"))
sourceX=1
for targetX in range(frame2, frame2+getWidth(runner)):
sourceY=200
for targetY in range(frame2, frame2+getHeight(runner)):
color = getColor(getPixel(runner, int(sourceX), int(sourceY)))
setColor(getPixel(canvas, targetX, targetY), color)
sourceY=sourceY+1
sourceX=sourceX+1


for frame in range(1, 100):
canvas=makePicture(getMediaPath("fenway.jpg"))
runner=makePicture(getMediaPath("runner.jpg"))
sourceX=1
for targetX in range(frame2, frame2+getWidth(runner)):
sourceY=200
for targetY in range(frame2, frame2+getHeight(runner)):
color = getColor(getPixel(runner, int(sourceX), int(sourceY)))
setColor(getPixel(canvas, targetX, targetY), color)
sourceY=sourceY+1
sourceX=sourceX+1

To TA Larry Olson–I tried to test my movie after I got all of the frames, but I got an out of memory error. It worked when I sent it to my friend's computer, so if you have any trouble email me.
Will Smolenski gtg608y@mail.gatech.edu



Link to this Page