[Image-SIG] ImageMath power-function error

Fredrik Lundh fredrik at pythonware.com
Mon Mar 16 15:05:33 CET 2009


No time to double-check, but I suspect the 1.1.6 version doesn't
support ** - it's mentioned in the documentation, but I don't see any
sign of it in the source code.  It's on my list of things to fix for
1.1.7.

</F>

2009/3/15 Mark Wendell <mark.wendell at gmail.com>:
> Hey all,
>
> I can't seem to use the power ("**") operator in the ImageMath module.
>
>
> For example, multiplying an L-mode image by a factor of 2.0 works fine:
>
>>>> out = ImageMath.eval( "convert( ( a*val ), 'L')", a=im, val=2.0)
> (no errors)
>
> However, raising the same image by a power of 2.0 generates a bad operand
> type error:
>
>>>> out = ImageMath.eval( "convert( ( a**val ), 'L')", a=im, val=2.0)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python2.5/site-
> packages/PIL/ImageMath.py", line 203, in eval
>     out =__builtin__.eval(expression, args)
>   File "<string>", line 1, in <module>
>   File "/usr/lib/python2.5/site-packages/PIL/ImageMath.py", line 119, in
> __pow__
>     return self.apply("pow", self, other)
>   File "/usr/lib/python2.5/site-packages/PIL/ImageMath.py", line 82, in
> apply
>     raise TypeError, "bad operand type for '%s'" % op
> TypeError: bad operand type for 'pow'
>
>
> Am I making a silly mistake?
>
> thanks in advance,
> Mark
>
> Ubuntu 8.10 linux, python 2.5.2, Pil 1.1.6
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig
>
>


More information about the Image-SIG mailing list