Forum Archive

photo asset.location setting does not set GPS exifs

cvp

I try to use the photos module to set the GPS tags/exifs of a photo.
If I pick two assets from the camera roll, a1 which has GPS tags and a2 without GPS tags, and if my script does
a2.location = a1.location
the standard Photos app shows correctly where the photo has been taken,
but other applications do not find the GPSInfo exif in the photo file.

Smallest code for testing, assuming you pick 2 photos, the first one having GPS tags, the 2nd not.

# coding: utf-8
import photos

def main():
    c = photos.get_assets(media_type='image')
    ps = photos.pick_asset(assets=c, title='Pick photos', multi=True)
    for p in ps:
        print(p.location)
        if p.location:
            # Photo has GPS tags
            prev_location = p.location
        else:
            # Photos does not have GPS tags, use previous if any
            if prev_location:
                p.location = prev_location

if __name__ == '__main__':
    main()
cvp

Google Photos app also shows where the photo has been taken.
ViewExif app does not.
Pythonista app using "from PIL.ExifTags import TAGS,GPSTAGS" does not see any GPS exifs.
Exif Viewer app shows where the photo has been taken
Yes in normal mode
Not in share mode, strange, isn't it?

Perhaps, as the photo has been modified by a Pythonista script updating the asset.location, is the photo stored twice, one as original (without GPS tags), a second as modified (with GPS tags)! I really don't know how Apple stores modified photos.

cvp

Reading a lot about iOS modified Photos, I've learned that the file contains the original photo and some metadata (exifs), Apple MakerNote, contains the data for modifying the photo (filters, added Gps tags, ...).