[Image-SIG] Re: Image.eval problem with math.sqrt

wmcclain at salamander.com wmcclain at salamander.com
Mon Jul 14 07:46:38 EDT 2003

On 13 Jul 2003 20:10:17 -0400
"Alan Grosskurth" <alan.grosskurth at utoronto.ca> wrote:

> That works fine for 8-bit images, but I'm
> still have trouble with mode 'I' images (32-bit integer):
>     image = Image.new('I', (10, 10))
>     out = Image.eval(image, math.sqrt)

This gets beyond my knowledge. That code calls point(), and according to
the docs:

    If the image has mode "I" (integer) or "F" (floating point), you
    must use a function, and it must have the following format: argument
    * scale+ offset 

    Example: Map floating point images 

        out = im.point(lambda i: i * 1.2 + 10) 

    You can leave out either the scale or the offset.

Using the example lambda works in your eval(), but I don't see how to
get in a sqrt(). Perhaps someone with better Python knowledge can help?

Sattre Press                                The King in Yellow
http://sattre-press.com/                 by Robert W. Chambers
info at sattre-press.com             http://kiy.sattre-press.com/ 

More information about the Image-SIG mailing list