Fix for dumping exif data loaded from images that contain a Gps Versi…#78
Open
wynnw wants to merge 1 commit intohMatoba:masterfrom
Open
Fix for dumping exif data loaded from images that contain a Gps Versi…#78wynnw wants to merge 1 commit intohMatoba:masterfrom
wynnw wants to merge 1 commit intohMatoba:masterfrom
Conversation
…onID tag - This puts in python2 specific conditional check into _value_to_bytes() that will make sure a raw_value of type str uses struct.unpack to generate int's to send to the _pack_byte() function, otherwise it crashes trying to create ints from the chars in the str object. This crash was found when loading exif data from a picture shot with a Canon PowerShot SX50 HS (according to the exif data), and it's Gps/VersionID value was 2.3.0.0 but at run time was loaded as '\x02\x03\x00\x00'. This probably needs an equivalent fix for Python 3.
|
Hi, I am trying to write coordinates of a different system and save the modified exif to a new image using python 3.6. I am getting struct.error: argument out of range in dump. What am I doing wrong? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…onID tag
will make sure a raw_value of type str uses struct.unpack to generate int's
to send to the _pack_byte() function, otherwise it crashes trying to create
ints from the chars in the str object.
This crash was found when loading exif data from a picture shot with a
Canon PowerShot SX50 HS (according to the exif data), and it's Gps/VersionID
value was 2.3.0.0 but at run time was loaded as '\x02\x03\x00\x00'.
This probably needs an equivalent fix for Python 3.
I haven't added a test as I'm not sure if this is conceptually the right fix, as it could be a problem with all sorts of fields. I see you haven't addressed #67, so maybe this isn't something you want the library to deal with? Seems like there's way too many interpretations of the exif spec so I understand this is a tough problem.
My use case for using this library was to auto-rotate images using Pillow based on their exif orientiation value, update the exif data's orientation flag, and then save the updated image without losing it's exif data. Right now I'll have to throw away the exif data if there's a problem creating the new exif bytes - it would be nice if it was more reliable to load/save the exif.
What are you thoughts?