Re: PIL and division

3 views
Skip to first unread message

Sebastian Haase

unread,
Apr 22, 2008, 4:17:27 AM4/22/08
to Lin Shao, Priithon
Hi Lin!

Please change it back ! And sorry that I'm so slow on the draw!
Attached is a tgz of "PIL_py" please copy all files from that (fake)
folder into the PIL folder.
It contains all (only) the py files of PIL.
I have fixed the division problem. It was onlt at a handful of places.
((You should also do a diff -r first, if you don't believe me ;-) I
kept your TIFF byte-order patch. ))

This now also has the (few) changes I made to support mult-page TIFF writing.
For that you need the new useful.py -- attached ( + a SIFreader for
native Andor files)
Now U.saveImg is "smart" -- see its docstring.

More questions ?

-Sebastian

On Mon, Apr 21, 2008 at 11:10 PM, Lin Shao <sh...@msg.ucsf.edu> wrote:
> Ok, never mind. I figured out how to disable the future division (I
> forgot you had a '-Qnew' flag in priithon_script). Basically, with
> -Qold, the vSaveRGBViewport works fine. I think you should bring up
> this issue to PIL group.
>

PIL_py.tgz
useful.py
sifreader.py

Sebastian Haase

unread,
Apr 22, 2008, 4:22:27 AM4/22/08
to Lin Shao, Priithon
On Mon, Apr 21, 2008 at 10:30 PM, Lin Shao <sh...@msg.ucsf.edu> wrote:
> Hi,
>
> I often got warning or error from PIL since the era of priithon25, like this:
>
> >>>Y.vSaveRGBviewport(0, 'i0.0001_dN_C.tif')
> Traceback (most recent call last):
> File "<input>", line 1, in <module>
> File "/home/haase/Priithon_25_lin/Priithon/usefulX2.py", line 1406,
> in vSaveRGBviewport
> U.saveImg(a, fn)
> File "/home/haase/Priithon_25_lin/Priithon/useful.py", line 2043, in saveImg
> im.save(fn)
> File "/home/haase/Priithon_25_lin/PIL/Image.py", line 1405, in save
> save_handler(self, fp, filename)
> File "/home/haase/Priithon_25_lin/PIL/TiffImagePlugin.py", line 791, in _save
> offset = ifd.save(fp)
> File "/home/haase/Priithon_25_lin/PIL/TiffImagePlugin.py", line 438, in save
> data = string.join(map(o32, value), "")
> File "/home/haase/Priithon_25_lin/PIL/TiffImagePlugin.py", line 71, in ol32
> return chr(i&255) + chr(i>>8&255) + chr(i>>16&255) + chr(i>>24&255)
> TypeError: unsupported operand type(s) for &: 'float' and 'int'
>
>
>
> I'm pretty sure this is caused by the floating point division. Is
> there a way to disable the default behavior? Have you noticed similar
> postings on the PIL list?
>
Which ones ? Please send me a link !
Did you notice my PIL discussion on the SciPy list ?
Maybe all (most) we need from PIL will soon be in SciPy.


> BTW, there's a bug in readGLviewport() in viewerCommon.py. 'has_key'
> should be 'hasattr'

I'm sorry again -- I already had this fixed in my version.
Maybe I can soon put my changes into the "priithon" google code project ;-)

-S.

Reply all
Reply to author
Forward
0 new messages