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.