Presentation is loading. Please wait.

Presentation is loading. Please wait.

Creating a picture in JES Use in the command window of JES (black background at bottom) to set the folder where the picture is to be saved >>> path = setMediaPath()

Similar presentations


Presentation on theme: "Creating a picture in JES Use in the command window of JES (black background at bottom) to set the folder where the picture is to be saved >>> path = setMediaPath()"— Presentation transcript:

1 Creating a picture in JES Use in the command window of JES (black background at bottom) to set the folder where the picture is to be saved >>> path = setMediaPath() When ‘pic’ is a variable name of a picture, save it to the folder by >>> writePictureTo(pic, path+’frame00.jpg’)

2 How to create a sequence of pictures ? – use JES function def makeRectMovie(directory ): for num in range (0,30): #30 frames (0 to 29) canvas = makeEmptyPicture (300,200) addRectFilled(canvas,num * 10, num * 5, 50,50, red) # convert the number to a string numStr=str(num) if num < 10: writePictureTo(canvas,directory+“/frame0"+numStr+".jpg") if num >= 10: writePictureTo(canvas,directory+“/frame"+numStr+".jpg")

3 When copying and pasting makeRectMovie() from Powerpoint, need to re-type ‘”’

4 A Few Frames frame00.jpg frame02.jpgframe50.jpg

5 Windows Movie Maker

6 Windows Movie Maker: Making a movie from images Free with most Windows installations.

7 Windows Movie Maker: Choose “Import Pictures” and select all the images in your sequence.

8 Creating the Movie Set the “Options” (Tools menu) so that there is a small duration between pictures. Drag all the pictures into the timeline.

9 Saving the Movie

10 Can we move more than one thing at once? Sure! def movingRectangle2(directory ): for num in range (1,30): #29 frames canvas = makeEmptyPicture (300,250) # add a filled rect moving linearly addRectFilled(canvas,num*10,num*5, 50,50,red) # Let’s have one just moving around blueX = 100+ int (10 * sin(num)) blueY = 4*num+int (10* cos(num)) addRectFilled(canvas,blueX,blueY,50,50, blue) # Now, write out the frame # Have to deal with single digit vs. double digit numStr=str(num) if num < 10: writePictureTo(canvas,directory +"/frame0 "+ numStr +". jpg") if num >= 10: writePictureTo(canvas,directory +"/frame "+ numStr +". jpg")

11 Moving two things at once

12 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 Text sliding right to left

13 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

14 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+"/frame"+getCharNum(num)+".jpg")

15 LAB_1113 Complementing a picture by complementing a column of picture at a time from left to right Capture the process of converting a picture to its complement 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 complements, 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 2015fall91.100@gmail.com


Download ppt "Creating a picture in JES Use in the command window of JES (black background at bottom) to set the folder where the picture is to be saved >>> path = setMediaPath()"

Similar presentations


Ads by Google