LeoHsiao1 / pyexiv2

Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile.
GNU General Public License v3.0
201 stars 39 forks source link

read_exif twice or to dict will crash pyexiv2 #2

Closed peter17 closed 5 years ago

peter17 commented 5 years ago

Hi!

I encounter a problem with pyexiv2: the following will work fine:

Python 3.7.3 (default, Apr  4 2019, 08:55:10) 
[GCC 8.3.1 20190329] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyexiv2            
>>> image = pyexiv2.Image('image.jpg')
>>> image.read_exif()
{'Exif.Image.Make': 'Panasonic', 'Exif.Image.Model': 'DMC-FZ1000', ...

But calling read_exif a second time or saving output to a dict will produce:

>>> image.read_exif()
corrupted size vs. prev_size
Abandon (core dumped)
>>> exif = image.read_exif()
corrupted size vs. prev_size
Abandon (core dumped)

What can I do? Thanks in advance! Best regards

LeoHsiao1 commented 5 years ago

I'm sorry I didn't notice this problem in time.

I haven't encountered this problem yet. The reason may be that your image metadata is a special value that I haven't encountered yet.

Please forward your image file to me and let me have a try.

I can successfully perform the following operations:

Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyexiv2
>>> i = pyexiv2.Image("1.jpg")
>>> i.read_exif()
{'Exif.Image.ImageDescription': '11', 'Exif.Image.ExifTag': '2158',  ...
>>> len(i.read_exif())
9
>>> i.modify_exif({'Exif.Image.Make': 'Panasonic'})
>>> i.read_exif()["Exif.Image.Make"]
'Panasonic'
peter17 commented 5 years ago

Hi @LeoHsiao1 I tried again and it is working fine now... I don't understand why. That image may have been corrupted... Thanks. Best regards.

github-actions[bot] commented 3 years ago

This issue has been automatically closed because there has been no activity for a month.