[Image-SIG] BMP Palettes

Rob Myroon robmyroon@yahoo.com
Tue, 12 Nov 2002 13:03:00 -0800 (PST)


--- Rob Myroon <robmyroon@yahoo.com> wrote:
> Hi Thomi,
> 
> I am not an expert at this but I don't think PIL can
> convert an 8 bit bmp to a 24 bit bmp.  (Never mind
> the
> part about giving one bmp another bmp's palette.)
> 

Ooops! I said I wasn't an expert! :)

I believe you can use the convert() method to convert
a 24 bit bmp to an 8 bit bmp.

im = Image.open("x.bmp")   # open 24 bit bmp
im2 = im.convert("P")      # convert to P mode (8 bit)
im2.save("newbmp.bmp")     # save new 8 bit bmp

# new image im2 is 8 bit

But this doesn't solve your problem about using
another bmp's palette.

Rob


__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2