Hey i was wondering if there was any way to convert a 24 bit Bitmap into a 256 colour bitmap using PIL or something simillar. I found something like:

image = image.convert("P",color = Image.ADAPTIVE)

But i couldn't work out how to make that work.
So yeah any way that you know would be lovely.

Cheers

Recommended Answers

All 2 Replies

This appears to work:

>>> im = Image.open("24bit test.bmp")
>>> im2 = im.convert("P")
>>> im2.save("256bit test.bmp")

The bit-depth of the output file is 8, so I assume that's what you were after?

Jeff

Oh yeah that worked a charm, i just realised my problem.. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.