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.
--Ned.
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
Image.eval(im2,function).show()
or save it to a new image which you can save
newimage=Image.eval(im2,function)
Dennis Shimer
On 1/11/07, Cochran, Travis <[EMAIL PROTECTED]> 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
wrong?
-Travis Cochran
_______________________________________________
Image-SIG maillist - Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig
_______________________________________________
Image-SIG maillist - Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig
--
Ned Batchelder, http://nedbatchelder.com
_______________________________________________
Image-SIG maillist - Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig