All pastes #824747 Raw Edit

Mine

public python v1 · immutable
#824747 ·published 2007-12-20 04:46 UTC
rendered paste body
import osfrom tempfile import *from PIL import Imagedef get_file_stream():    # magic    fn = raw_input("Input Filename Here: ")    f = open(fn,'rb')    rv = f.read()    f.close()    return rv# workaround starts heretf = mkstemp()os.close(tf[0])f = open(tf[1],'r+b')f.seek(0)f.write(get_file_stream())f.close()i = Image.open(tf[1])print i.getcolors()# do image stuff herei.crop((0,0,1,1))i.save('NUL','JPEG')# image do stuff ends hereos.unlink(tf[1])# workaround ends here