Context:
- I am using python 2.6.5
Goal:
- Read a binary image file and represent it in-memory. Then run a checksum on it. Deliver the binary representation to be stored as a blob in mysql.
Comments:
Context:
Goal:
Comments:
I'd recommend using PIL (Python Image Library)
http://effbot.org/imagingbook/pil-index.htm
Save it down to a string and then write to the db. Then you can use the string butter interface to PIL to read it back out.
>>> from binascii import crc32
>>> with open(filename, "rb") as f:
... data = f.read()
...
>>> crc32(data)
361260080