Noah.org wrote:
> How can I set the absolute white or black level of an image?
> I want all pixels above or below a certain value clipped.
> For example, I want all pixels brighter than 200 to be set to 255
> (assuming an 8-bit gray-scale image).

It sounds to me like you want the image point method.

http://effbot.org/imagingbook/image.htm#Image.point

Something like this will expand the middle range of an image and clip
the extremes:

t = [min(255, max(0, x + x/4 - 32)) for x in range(256)]
im_clipped = im.point(t)



douglas
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to