[Image-SIG] PIL 1.1.6 eval function

Dennis Shimer dshimer at gmail.com
Thu Jan 11 16:44:00 CET 2007


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 <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
> wrong?
> -Travis Cochran
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig
>


More information about the Image-SIG mailing list