creating a picture in jes use in the command window of jes (black background at bottom) to set the...

15
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’)

Upload: james-lambert

Post on 17-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 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()

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’)

Page 2: 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()

How to create a sequence of pictures ? – use JES functiondef 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 stringnumStr=str(num)if num < 10:

writePictureTo(canvas ,directory+“/frame0"+numStr+".jpg")

if num >= 10:writePictureTo(canvas

,directory+“/frame"+numStr+".jpg")

Page 3: 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 copying and pasting makeRectMovie() from Powerpoint, need to re-type ‘”’

Page 4: 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()

A Few Frames

frame00.jpg frame02.jpg frame50.jpg

Page 5: 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()

Windows Movie Maker

Page 6: 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()

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

installations.

Page 7: 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()

Windows Movie Maker:

Choose “Import Pictures” and select all the images in your sequence.

Page 8: 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()

Creating the Movie

Set the “Options” (Tools menu) so that there is a small duration between pictures.

Drag all the pictures into the timeline.

Page 9: 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()

Saving the Movie

Page 10: 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()

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 linearlyaddRectFilled(canvas ,num*10,num*5, 50,50,red)# Let’s have one just moving aroundblueX = 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 digitnumStr=str(num)if num < 10:

writePictureTo(canvas ,directory +"/frame0 "+ numStr +". jpg")if num >= 10:

writePictureTo(canvas ,directory +"/frame "+ numStr +". jpg")

Page 11: 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()

Moving two things at once

Page 12: 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()

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

Page 13: 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()

Tickertapedef 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

Page 14: 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()

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")

Page 15: 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()

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 [email protected]