Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reading android image return: AttributeError: 'NoneType' object has no attribute 'size' #23

Open
pat1 opened this issue Jan 8, 2016 · 1 comment

Comments

@pat1
Copy link

pat1 commented Jan 8, 2016

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 ;)

test

@pat1
Copy link
Author

pat1 commented Jan 8, 2016

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

tinusg added a commit to tinusg/pexif that referenced this issue May 10, 2016
RyanK1m pushed a commit to RyanK1m/pexif that referenced this issue Nov 25, 2016
RyanK1m pushed a commit to RyanK1m/pexif that referenced this issue Nov 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant