Open pat1 opened 8 years ago
with this simple test program:
import pexif # Modify the exif in a file img = pexif.JpegFile.fromFile("test.jpg") img.exif.primary.ImageDescription = "Hello world!" img.writeFile("tmp1.jpg")
python test.py Traceback (most recent call last): File "test.py", line 4, in <module> img = pexif.JpegFile.fromFile("test.jpg") File "/home/pat1/tmp/jpg/pexif.py", line 1002, in fromFile return JpegFile(f, filename=filename, mode=mode) File "/home/pat1/tmp/jpg/pexif.py", line 1065, in __init__ attempt = segment_class(mark, input, data, self.mode) File "/home/pat1/tmp/jpg/pexif.py", line 858, in __init__ DefaultSegment.__init__(self, marker, fd, data, mode) File "/home/pat1/tmp/jpg/pexif.py", line 151, in __init__ self.parse_data(data) File "/home/pat1/tmp/jpg/pexif.py", line 902, in parse_data ifd = IfdTIFF(self.e, offset, self, self.mode, tiff_data) File "/home/pat1/tmp/jpg/pexif.py", line 418, in __init__ actual_data = self.embedded_tags[tag][1](e, the_data, exif_file, self.mode, data) File "/home/pat1/tmp/jpg/pexif.py", line 412, in __init__ exif_type_size(exif_type), components, File "/home/pat1/tmp/jpg/pexif.py", line 250, in exif_type_size return ExifType.lookup.get(exif_type).size AttributeError: 'NoneType' object has no attribute 'size'
attached the sample image; sorry for the subject ;)
The problem is a missing format: value 8 signed short Bytes/component 2
define: SIGNEDSORT = ExifType(8, "signedshort", 2).id
and manage it solve the problem. Paolo
with this simple test program:
attached the sample image; sorry for the subject ;)