Created
August 30, 2014 16:30
-
-
Save SwartzCr/a84a0bb3a48d6a0b62e1 to your computer and use it in GitHub Desktop.
glitch problems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Image | |
import StringIO | |
import imager | |
img1 = imager.get_image1() | |
img = Image.open(StringIO.StringIO(img1)) | |
Traceback (most recent call last): | |
File "<input>", line 1, in <module> | |
File "/home/swartzcr/Documents/coding/Projects/revisit/local/lib/python2.7/s | |
ite-packages/PIL/Image.py", line 1980, in open | |
raise IOError("cannot identify image file") | |
IOError: cannot identify image file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
def get_image1(): | |
with open("me at toor.jpg", 'rb') as image_file: | |
encoded_string = base64.b64encode(image_file.read()) | |
return encoded_string | |
def get_image2(): | |
with open("georgetown.png", 'rb') as image_file: | |
encoded_string = base64.b64encode(image_file.read()) | |
return encoded_string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment