gif to bitmap in python
tiddlerdeja at my-deja.com
tiddlerdeja at my-deja.com
Tue Aug 29 13:01:11 EDT 2000
Thanks for that.
Is there a way to do a conversion without PIL? I don't seem to have it
available.
In article <8ogmj1$gmv$1 at nnrp1.deja.com>,
Greg Landrum <glandrum at my-deja.com> wrote:
> In article <8oghku$a9t$1 at nnrp1.deja.com>,
> tiddlerdeja at my-deja.com wrote:
> > Can anyone tell me how, or give an example of howto convert a gif
> image
> > to a bitmap representation of it?
> >
>
> I'm not completely sure what you mean by "bitmap representation", but
> PIL probably does what you want. :-)
>
> To convert to a BMP (windows bitmap), you would do:
> >>> from Pil import Image
> >>> img = Image.open('foo.gif')
> >>> img.save('foo.bmp')
>
> If you would rather get a Numeric array with the values from the
image:
> >>> from Pil import Image
> >>> from Numeric import *
> >>> img = Image.open('foo.gif')
> >>> arr = resize(fromstring(img.tostring(),Int8),img.size)
>
> I hope this helps.
> -greg
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list