Python: Access photos on iPhone for Exif Data

Viewed 109

I am looking to access all photos on my iPhone using Python. I want to be able to exract the Exif data to load into Leaflet / Folium.

It would seem that I cannot access the path for the photos because the phone is connected using a MTP Connection.

I found a script and managed to modify it to allow me to list all photos on the phone in the DCIM directory.

for pidl in folder.EnumObjects(0, shellcon.SHCONTF_NONFOLDERS):
    name = folder.GetDisplayNameOf(pidl, shellcon.SHGDN_FORADDRESSBAR)
    dirname = os.path.dirname(name)
    basename, ext = os.path.splitext(os.path.basename(name))

            #print (name)
            #print (dirname)
            #print (basename)
            if ext.endswith("JPG") and i == 1:
                photo_dict[dirname].append(name)
                i =+ 1
print (photo_dict[dirname][0])

I am access the path to the image, but when I try and open the image using PIL, I receive an error that the path does not exist. Which I am guessing is due to the MTP connection and the way that interacts with the File Explorer.

How can I process imagery using the path provided by my script, is there a better method? I want to keep the files on the phone, so copying off is not an option.

I am using Python 3.5 and Windows 10.

0 Answers
Related