开发者

Python Imaging, how to quantize an image to 16bit depth?

I would like to quantize a 24bit image to 16bit color depth using Python Imaging.

PIL used to provide a method im.quantize(colors, **options) however this has been deprecated for ou开发者_StackOverflow社区t = im.convert("P", palette=Image.ADAPTIVE, colors=256)

Unfortunately 256 is the MAXIMUM number of colors that im.convert() will quantize to (8 bit only).

How can I quantize a 24bit image down to 16bit using PIL (or similar)?

thanks


You might want to look into converting your image to a numpy array, performing your quantisation, then converting back to PIL.

There are modules in numpy to convert to/from PIL images.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜