Download presentation
Presentation is loading. Please wait.
Published byCalvin Sherman Modified over 9 years ago
1
Tickertape def tickertape(directory,string): for each frame to generate create an new canvas write the string on canvas slightly left of the previous frame get char string of frame number frame number starting with ‘0’ save the canvas
2
Tickertape def tickertape(directory,string): for num in range(1,100): #99 frames canvas = makeEmptyPicture(300,100) #Start at right, and move left addText(canvas,300-(num*10),50,string) # Now, write out the frame # Handle frame number numStr=str(num) if num < 10: seq = ‘0’+numStr else: seq = numStr writePictureTo(canvas,directory+ "/frame’+seq+".jpg") def tickertape(directory,string): for each frame to generate create an new canvas write the string on canvas slightly left of the previous frame get char string of frame number frame number starting with ‘0’ save the canvas
3
Making a tickertape - 2 def getCharNum(thisNum): if thisNum <10: return ‘0'+str(thisNum) else: return str(thisNum) def tickertape(directory,string): for num in range(1,100): #99 frames canvas = makeEmptyPicture(300,100) #Start at right, and move left addText(canvas,300-(num*10),50,string) writePictureTo(canvas,directory+"/frame0"+getCharNum(num)+".jpg")
4
LAB You want to capture the process of converting a picture to its negative by saving the picture each time a new column is converted into a sequence of picture frames Each time a new column of pixels is converted to negatives, you want to save it into a picture frame, numbered ‘framexxx.jpg’ where ‘xxx’ is a sequential number Email only your python program (not a screen shot) to kim@cs.uml.edu kim@cs.uml.edu
5
Movie of picture negatives def getCharNum(n): if n <10: return ’00’+str(n) elif n <100: return ‘0’+str(n) else return str(n) # Pseudo Code def movieNeg(directory, pic): for each column of the picture for the entire width for each pixel from top of the column to bottom convert a pixel to its negative save the picture into frameXXX.jpg
6
Movie of picture negatives def getCharNum(n): if n <10: return ’00’+str(n) elif n <100: return ‘0’+str(n) else return str(n) # Pseudo Code def movieNeg(directory, pic): for each column of the picture across the entire width for each pixel from top of the column to bottom convert a pixel to its negative save the picture into frameXXX.jpg
7
Movie of picture negatives # Pseudo Code def movieNeg(directory, pic): for each column of the picture across the entire width for each pixel from top of the column to bottom convert a pixel to its negative save the picture into frameXXX.jpg # Python Code def movieNeg(directory, pic):
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.