gif
Skip Montanaro
skip at mojam.com
Thu Dec 16 09:54:05 EST 1999
Ulf> How do I open up an image in either .gif or .jpeg and save it to a
Ulf> textfile in base64? I know about the base64 mod, but it seems like
Ulf> I can't read the .gifs and .jpegs right. What should I do about
Ulf> this?
If you're on Windows, make sure you open the image file using the binary
flag:
gif = open(gifname, "rb")
b64 = open(b64name, "wb") # "b" shouldn't be needed here
base64.encode(gif, b64)
gif.close()
b64.close()
Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/
847-971-7098 | Python: Programming the way Guido indented...
More information about the Python-list
mailing list