I am using gtk.gdk.PixbufLoader since several years.
Today, I try to load a jpg file from a new android device and get this exception:
Traceback (most recent call last):
File "myscript.py", line 118, in next
loader.write(buf)
glib.GError: Error interpreting JPEG image file (Unsupported marker type 0x05)
The same file can be loaded in eog (eye of gnome) and I can use convert
(from image-magick) with out error.
It happens for all files, not just one, this leads me to the conclusion that the files are not broken.
What could be wrong?
Here is one of the files: http://thomas-guettler.de/20160627_163057-0.jpg
Here is a snippet to reproduce the exception:
from gtk.gdk import PixbufLoader
pixbufloader=PixbufLoader()
chunksize=130000
fd=open('20160627_163057-0.jpg', 'rb')
while True:
bytes=fd.read(chunksize)
if not bytes:
break
print pixbufloader.write(bytes)
pixbufloader.close()
If you set chunksize
to 1
, then it works.
If I use 130000
as chunksize, then the first call to write()
fails.
I worked on your code and got to the conclusion that exactly after chunksize = 69632,i.e. at chunksize = 69633,This error is shown. One more thing I noticed is that this error is file related.If I use any file other than this "20160627_163057-0.jpg" image,error does not occur.
So my conclusion is that this particular file has some problem. Please check, Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With