0

I'm creating a simple python app to go through a folder display each JPG and allow someone to edit the photo's Title,subject,comments and add tags, then save and move on to the next. (essentially, I want to avoid, in windows, having to right click>properties>details> and edit each of the above fields, then "OK".)

Can someone please recommend the libraries and modules I need to import to display the photo and edit the properties?

I'm new to Python, so a snippet of code to show how do do it would be most appreciated.

I'm using python 3.6 in Windows 10

Thanks in advance.

Mark S
  • 11
  • 1

1 Answers1

0

To change a photos EXIF data in python you can do something like:

Get EXIF Data:

import piexif
from PIL import Image

img = Image.open(fname)
exif_dict = piexif.load(img.info['exif'])

altitude = exif_dict['GPS'][piexif.GPSIFD.GPSAltitude]

Set / Save EXIF data:

exif_dict['GPS'][piexif.GPSIFD.GPSAltitude] = (140, 1)
exif_bytes = piexif.dump(exif_dict)
img.save('_%s' % fname, "jpeg", exif=exif_bytes)

Taken from this Answer

Minijack
  • 726
  • 7
  • 23