Skip to content

Instantly share code, notes, and snippets.

@SwartzCr
Created August 30, 2014 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SwartzCr/a84a0bb3a48d6a0b62e1 to your computer and use it in GitHub Desktop.
Save SwartzCr/a84a0bb3a48d6a0b62e1 to your computer and use it in GitHub Desktop.
glitch problems
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
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