Reducing wxImage to 256 colours

I need to reduce a wxImage to 256 colours to save it
in a format that only supports that many. Does anyone
have any code that can go into an open source project
that can do this? (My cunning plan to save it out
as gif and then reload was foiled by wxWindows not
saving out as gif :frowning:

I did find loads of C code out there, but it builds
histograms and trees, and doesn't look like it will
have at all decent performance converted to python.

Roger

This reads a BMP file from disk and saves as GIF...is this what you need ?

from PIL import Image
         .
         .
         im = Image.open('bitmaps/final.bmp')
         im.convert('RGB').save('bitmaps/final.gif')

On Sat, 30 Aug 2003 22:34:20 -0700, "Roger Binns" <rogerb@rogerbinns.com> escreveu:

De: "Roger Binns" <rogerb@rogerbinns.com>
Data: Sat, 30 Aug 2003 22:34:20 -0700
Para: <wxPython-users@lists.wxwindows.org>
Assunto: [wxPython-users] Reducing wxImage to 256 colours

I need to reduce a wxImage to 256 colours to save it
in a format that only supports that many. Does anyone
have any code that can go into an open source project
that can do this? (My cunning plan to save it out
as gif and then reload was foiled by wxWindows not
saving out as gif :frowning:

I did find loads of C code out there, but it builds
histograms and trees, and doesn't look like it will
have at all decent performance converted to python.

Roger

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Pedro Fontanari

<pedro@mediaplex.com.br>
(11) 9243-3406
MEDIAPLEX Administração de Projetos

This reads a BMP file from disk and saves as GIF...is this what you need ?

from PIL import Image
         .
         .
         im = Image.open('bitmaps/final.bmp')
         im.convert('RGB').save('bitmaps/final.gif')

Although PIL may do the trick, I don't want to use it, especially for
just one function. (My program runs on Windows, Linux and Mac so
adding new external libraries is a big pain to coordinate).

Roger