Re: [bug report] OverflowError: signed integer is greater than maximum
Edward Cannon <[email protected]> Sun, 18 Aug 2013 13:09:50 -0700
| Newsgroups | gmane.comp.python.image |
|---|---|
| Message-ID | <CAA=wcUaUbPcTHkj148Sg0pocoAhF9Y_sxgvQ5Q0der+5UZWr8Q@mail.gmail.com> |
--===============1227026530== Content-Type: multipart/alternative; boundary=047d7bdc192cf99d7004e43e6747 --047d7bdc192cf99d7004e43e6747 Content-Type: text/plain; charset=ISO-8859-1 have you tried to use the built in save function instead of the save_image function? It would look like img.save( '/tmp/1889935.jpg') you don't need to specify the file type or other parameters as long as the file has an appropriate extension. PS if you are just moving the image around and not changing it at all the shutil.copy() function from the standard libraries is much faster and lossless. On Thu, Jul 25, 2013 at 8:20 AM, Julien Palard <[email protected]> wrote: > I jiust reproduced the bug with another image that I can publicly release, > so you may easily reproduce it : > > http://mandark.fr/art/art/2011/01/16/2011-01-16-14-54-22.jpg > > > On Thu, Jul 25, 2013 at 5:11 PM, Julien Palard <[email protected]> wrote: > >> Hi there, I'm facing a bug in PIL, from the stable Debian Package, don't >> know the PIL exact version number as it's not exposed by the package but I >> got : >> >> apt-cache policy python-imaging >> python-imaging: >> Installed: 1.1.7-4 >> >> Here come the bug : >> >> $ python >> Python 2.7.3 (default, Jan 2 2013, 13:56:14) >> [GCC 4.7.2] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> from PIL import Image as PILImage >> >>> from pilkit.utils import save_image >> >>> >> >>> img = PILImage.open('./1889935.jpg') >> >>> save_image(img, '/tmp/1889935.jpg', 'JPEG', {}, True) >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> File >> "/usr/local/lib/python2.7/dist-packages/pilkit-1.0.0-py2.7.egg/pilkit/utils.py", >> line 175, in save_image >> img.save(outfile, format, **options) >> File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1439, in save >> save_handler(self, fp, filename) >> File "/usr/lib/python2.7/dist-packages/PIL/JpegImagePlugin.py", line >> 471, in _save >> ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)]) >> File "/usr/lib/python2.7/dist-packages/PIL/ImageFile.py", line 499, in >> _save >> s = e.encode_to_file(fh, bufsize) >> OverflowError: signed integer is greater than maximum >> >> How I may help ? >> >> -- >> Julien Palard - http://julien.palard.fr >> IRC : [email protected], [email protected] >> TEL : 06.21.19.49.10 / FAX : 09.72.28.06.72 >> > > > > -- > Julien Palard - http://julien.palard.fr > IRC : [email protected], [email protected] > TEL : 06.21.19.49.10 / FAX : 09.72.28.06.72 > > _______________________________________________ > Image-SIG maillist - [email protected] > http://mail.python.org/mailman/listinfo/image-sig > > --047d7bdc192cf99d7004e43e6747 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><div>have you tried to use the built in save function= instead of the save_image function? It would look like <br>img.save( '= /tmp/1889935.jpg')<br></div>you don't need to specify the file type= or other parameters as long as the file has an appropriate extension.<br> </div>PS if you are just moving the image around and not changing it at all= the shutil.copy() function from the standard libraries is much faster and = lossless.<br></div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_q= uote"> On Thu, Jul 25, 2013 at 8:20 AM, Julien Palard <span dir=3D"ltr"><<a hre= f=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>></s= pan> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex= ;border-left:1px #ccc solid;padding-left:1ex"> <div dir=3D"ltr">I jiust reproduced the bug with another image that I can p= ublicly release, so you may easily reproduce it :<br><br><a href=3D"http://= mandark.fr/art/art/2011/01/16/2011-01-16-14-54-22.jpg" target=3D"_blank">ht= tp://mandark.fr/art/art/2011/01/16/2011-01-16-14-54-22.jpg</a><br> </div><div class=3D"HOEnZb"><div class=3D"h5"><div class=3D"gmail_extra"><b= r><br><div class=3D"gmail_quote">On Thu, Jul 25, 2013 at 5:11 PM, Julien Pa= lard <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"_b= lank">[email protected]</a>></span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Hi there, I'm faci= ng a bug in PIL, from the stable Debian Package, don't know the PIL exa= ct version number as it's not exposed by the package but I got :<br> <br>apt-cache policy python-imaging<br> python-imaging:<br>=A0 Installed: 1.1.7-4<br><br></div>Here come the bug :<= br><div><br>$ python<br>Python 2.7.3 (default, Jan=A0 2 2013, 13:56:14) <br= >[GCC 4.7.2] on linux2<br>Type "help", "copyright", &qu= ot;credits" or "license" for more information.<br> >>> from PIL import Image as PILImage<br>>>> from pilkit.= utils import save_image<br>>>> <br>>>> img =3D PILImage.o= pen('./1889935.jpg')<br>>>> save_image(img, '/tmp/1889= 935.jpg', 'JPEG', {}, True)<br> Traceback (most recent call last):<br>=A0 File "<stdin>", l= ine 1, in <module><br>=A0 File "/usr/local/lib/python2.7/dist-pa= ckages/pilkit-1.0.0-py2.7.egg/pilkit/utils.py", line 175, in save_imag= e<br> =A0=A0=A0 img.save(outfile, format, **options)<br>=A0 File "/usr/lib/p= ython2.7/dist-packages/PIL/Image.py", line 1439, in save<br>=A0=A0=A0 = save_handler(self, fp, filename)<br>=A0 File "/usr/lib/python2.7/dist-= packages/PIL/JpegImagePlugin.py", line 471, in _save<br> =A0=A0=A0 ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, raw= mode)])<br>=A0 File "/usr/lib/python2.7/dist-packages/PIL/ImageFile.py= ", line 499, in _save<br>=A0=A0=A0 s =3D e.encode_to_file(fh, bufsize)= <br>OverflowError: signed integer is greater than maximum<br> <br></div><div>How I may help ?<span><font color=3D"#888888"><br clear=3D"a= ll"></font></span></div><span><font color=3D"#888888"><div><div><br>-- <br>= Julien Palard - <a href=3D"http://julien.palard.fr" target=3D"_blank">http:= //julien.palard.fr</a><br> IRC : <a href=3D"mailto:[email protected]" target=3D"_blank">mandark@fre= enode.net</a>, <a href=3D"mailto:[email protected]" target=3D"_blank">ma= [email protected]</a><br> TEL : 06.21.19.49.10 / FAX : 09.72.28.06.72<br> </div></div></font></span></div> </blockquote></div><br><br clear=3D"all"><br>-- <br>Julien Palard - <a href= =3D"http://julien.palard.fr" target=3D"_blank">http://julien.palard.fr</a><= br>IRC : <a href=3D"mailto:[email protected]" target=3D"_blank">mandark@= freenode.net</a>, <a href=3D"mailto:[email protected]" target=3D"_blank"= >[email protected]</a><br> TEL : 06.21.19.49.10 / FAX : 09.72.28.06.72<br> </div> </div></div><br>_______________________________________________<br> Image-SIG maillist =A0- =A0<a href=3D"mailto:[email protected]">Image-SI= [email protected]</a><br> <a href=3D"http://mail.python.org/mailman/listinfo/image-sig" target=3D"_bl= ank">http://mail.python.org/mailman/listinfo/image-sig</a><br> <br></blockquote></div><br></div> --047d7bdc192cf99d7004e43e6747-- --===============1227026530== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Image-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/image-sig --===============1227026530==--