exif icon indicating copy to clipboard operation
exif copied to clipboard

InsufficientMemoryError on specific image

Open martimpassos opened this issue 3 years ago • 2 comments

Hi, I'm making some tests with a sample image (from which I can successfully list_all on load) and got

InsufficientMemoryError occurred during unpack operation:

142065 too few bytes to unpack 'ifd_tag_le' (151176 needed, only 9111 available)

When trying to add/modify some tags, but the same code runs successfully for the florida_beach image provided in the tests folder. What kind of limitation I could be running into?

martimpassos avatar Feb 10 '22 18:02 martimpassos

Could you please provide a sample image? When uploading, please put it in a compressed folder (e.g., .zip) since GitHub strips metadata from uploaded images.

Could you also please include specific commands or a script you're using on that image?

TNThieding avatar Feb 10 '22 22:02 TNThieding

The code I used for testing:

with open('/content/_MG_3186.jpg', 'rb') as image_file:
  my_image = Image(image_file)

my_image.artist = "Martim Passos"
my_image.gps_latitude = (22.0, 56.0, 25.48)
my_image.gps_latitude_ref = "S"
my_image.gps_longitude = (43.0, 49.0, 33.89)
my_image.gps_longitude_ref = "W"
my_image.copyright = "https://creativecommons.org/publicdomain/mark/1.0/\nThis image is in the Public Domain."
my_image.user_comment = "Largo da Carioca. Ao fundo, o chafariz com 35 bicas"
my_image.datatime_digitized = "2020:01:01 00:00:00"

with open('/content/modified_image.jpg', 'wb') as new_image_file:
  new_image_file.write(my_image.get_file())

The image I tested with: exif-samples.zip

The error I got: 142065 too few bytes to unpack 'ifd_tag_le' (151176 needed, only 9111 available)

Glad to be of help if this is a relevant bug, but don't worry too much about it if you're swamped. I tinkered around a bit and managed to write everything I need on a sample of the actual set of images I'm working on. This is a random image I used for testing.

martimpassos avatar Feb 11 '22 18:02 martimpassos