List Info

Thread: Saving multi-frame images with palette




Saving multi-frame images with palette
user name
2006-09-06 02:19:11
I'm new here, using PIL (1.1.5) to do some front-end image
manipulation for
SpamBayes' nascent OCR capability.  One of the tricks the
spammers use now
is multi-frame GIFs where most/all of the text is on some
frame other than
the first one.  Here's an example:

    http://orca.m
ojam.com/~skip/bogus-0.gif

I'm hoping to poke around a bit in the image using PIL to
decide which frame
to analyze (in theory I could run OCR on all frames, but
it's an expensive
enough operation already) and also to save the frame I
select.

The above image presents a problem though.  Using this code:

    >>> img = Image.open("bogus-0.gif")
    >>> for frame in ImageSequence.Iterator(img):
    ...   frame.show()

the first frame is displayed using the image's palette. 
The rest are
displayed in black-and-white.  I suspect there's something
fishy about this
particular image.  I have another one that show()s just
fine, and this one
displays properly in Firefox, so at some level it must be
okay.

Any suggestions?

Thanks,

-- 
Skip Montanaro - skippobox.com - http://www.mojam.com/
"In China today, Bill Gates is Britney Spears.  In
America today, Britney
Spears is Britney Spears - and that is our problem." 
Thomas L. Friedman in
"The World is Flat"
_______________________________________________
Image-SIG maillist  -  Image-SIGpython.org
htt
p://mail.python.org/mailman/listinfo/image-sig
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )