[Image-SIG] PIL 1.1.6 eval function
ned at nedbatchelder.com
Thu Jan 11 18:07:03 CET 2007
The important thing to remember about eval() is that it does not operate
on the entire pixel: the function is for a single color channel at a
time, and behaves the same on all channels in the image. So your
function takes a single argument, and returns a single value. Then the
function is used to adjust the values of pixels one channel at a time.
Also, the function isn't actually evaluated for each pixel: it is used
to build a lookup table, then the table is used to remap values.
Dennis Shimer wrote:
> This worked for me.
> open an image object, I'll call im
> Write a function that you would like applied to each pixel of im, here
> is a dumb one that will just double the value this making the new
> image very very bright.
> def function(pixel):
> return pixel*2
> Then eval the image based on the function
> or save it to a new image which you can save
> Dennis Shimer
> On 1/11/07, Cochran, Travis <Travis.Cochran at analog.com> wrote:
>> I'm trying to use the Image.eval function on a JPEG image. I can't seem
>> to find the right syntax for entering the function and it gives me
>> errors for the variables I try to use, "R,G,B". Any idea what I'm doing
>> -Travis Cochran
>> Image-SIG maillist - Image-SIG at python.org
> Image-SIG maillist - Image-SIG at python.org
Ned Batchelder, http://nedbatchelder.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Image-SIG