Hi, all.
Is it possible to get PIL to save GIF's in GIF89A format, instead of
GIF87A? If not, are there any decent other image libraries out there
that anyone's familiar with? The only one I could find was
PythonMagick, which seems completely undocumented. Or I'm blind.
Ahem.
But the problem is, I have a nice, small little 72 byte GIF89A file,
that I want to do some slight tweaking on and then re-save. I noticed
that even if I completely skipped the tweaking step and -just- saved,
it exploded into a 919 byte GIF87A file. And in this context, bytes
really, really matter. I picked GIF over PNG because the same file in
PNG was 120 bytes :)
I'm not an expert on graphics, so I don't actually know for certain if
its the fact that PIL is saving in GIF87A format that's causing the
size to explode, it might just be that PIL is doing.. Something Weird
when it saves it as a GIF, too.
To demonstrate:
f = open('../tiles/BaseTemplate.gif', 'rb')
d1 = f.read()
len(d1)
73
d1
'GIF89a\x10\x00\x10\x00\x80\x00\x00\xff\xff\xff\x00\x00\x00!\xf9\x04\x00\x00\x00\x00\x00,\x00\x00\x00\x00\x10\x00\x10\x00\x00\x02
\x8c\x8fi\xc0\xed\xbe\x9edq\xbej\x1b\xce`go\x81\x93(\x91W\xc0AhJ\xad\xac\xa9*\xb2Q\x00\x00;'
im = Image.open('../tiles/BaseTemplate.gif')
import cStringIO
cfp = cStringIO.StringIO()
im.save(cfp, format="gif")
cfp.seek(0)
d2 = cfp.read()
d2
'GIF87a\x10[...snip...]\x00;'
len(d2)
919
--
--S
... p.s: change the ".invalid" to ".com" in email address to reply privately.
--
http://mail.python.org/mailman/listinfo/python-list