09_2_loadAndSave - picture transformation functions we've...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
# Set and return the mediapath def mediaPath(): setMediaPath() return getMediaPath() # Find out what files are in the media path def whatFilesAreInMediaPath(): from os import listdir # listdir is an operating system function # It returns a list of file names (text strings) mpath = listdir(mediaPath()) return mpath() # Load and save a named picture file in the media path # E.g. loadAndSave("my_weird_facebook_picture.jpg") # This just makes a backup copy named "backup.jpg", but you could # easily transform the file before saving it by using one of the many
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: # picture transformation functions we've discussed. # # Note the differences between the following pieces of data. .. # inputFileName (the parameter) is a text string: the name of a picture file # outputFileName is also a text string: the name of a picture file # picture is the picture extracted from the file with the name inputFileName def loadAndSave(inputFileName): picture = makePicture(inputFileName) # You can transform the picture here if you like outputFileName = "backup.jpg" writePictureTo(picture, outputFileName)...
View Full Document

This document was uploaded on 10/27/2011 for the course CS 1315 at Georgia Tech.

Ask a homework question - tutors are online