Hmm. The 1.1.6 docs for the ImageMath module say "The module also supports unary minus (-), modulo (%), and power
(**) operators."<br><br>Still, if not, looking forward to having the functionality in 1.1.7.<br><br>thanks<br>Mark<br><br><div class="gmail_quote">On Mon, Mar 16, 2009 at 8:05 AM, Fredrik Lundh <span dir="ltr"><<a href="mailto:fredrik@pythonware.com">fredrik@pythonware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">No time to double-check, but I suspect the 1.1.6 version doesn't<br>
support ** - it's mentioned in the documentation, but I don't see any<br>
sign of it in the source code. It's on my list of things to fix for<br>
1.1.7.<br>
<font color="#888888"><br>
</F><br>
</font><div class="im"><br>
2009/3/15 Mark Wendell <<a href="mailto:mark.wendell@gmail.com">mark.wendell@gmail.com</a>>:<br>
</div><div><div></div><div class="h5">> Hey all,<br>
><br>
> I can't seem to use the power ("**") operator in the ImageMath module.<br>
><br>
><br>
> For example, multiplying an L-mode image by a factor of 2.0 works fine:<br>
><br>
>>>> out = ImageMath.eval( "convert( ( a*val ), 'L')", a=im, val=2.0)<br>
> (no errors)<br>
><br>
> However, raising the same image by a power of 2.0 generates a bad operand<br>
> type error:<br>
><br>
>>>> out = ImageMath.eval( "convert( ( a**val ), 'L')", a=im, val=2.0)<br>
> Traceback (most recent call last):<br>
> File "<stdin>", line 1, in <module><br>
> File "/usr/lib/python2.5/site-<br>
> packages/PIL/ImageMath.py", line 203, in eval<br>
> out =__builtin__.eval(expression, args)<br>
> File "<string>", line 1, in <module><br>
> File "/usr/lib/python2.5/site-packages/PIL/ImageMath.py", line 119, in<br>
> __pow__<br>
> return self.apply("pow", self, other)<br>
> File "/usr/lib/python2.5/site-packages/PIL/ImageMath.py", line 82, in<br>
> apply<br>
> raise TypeError, "bad operand type for '%s'" % op<br>
> TypeError: bad operand type for 'pow'<br>
><br>
><br>
> Am I making a silly mistake?<br>
><br>
> thanks in advance,<br>
> Mark<br>
><br>
> Ubuntu 8.10 linux, python 2.5.2, Pil 1.1.6<br>
</div></div><div><div></div><div class="h5">> _______________________________________________<br>
> Image-SIG maillist - <a href="mailto:Image-SIG@python.org">Image-SIG@python.org</a><br>
> <a href="http://mail.python.org/mailman/listinfo/image-sig" target="_blank">http://mail.python.org/mailman/listinfo/image-sig</a><br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--<br>Mark Wendell<br><a href="mailto:mark.wendell@gmail.com">mark.wendell@gmail.com</a><br>