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.
精彩评论