Saturday, January 11, 2014

Corey Goldberg: Python

I have a large image library of photos I've taken or downloaded over the years. They are from various cameras and sources, many with missing or incomplete metadata.



This is problematic because some image viewing programs and galleries use metadata to sort images into timelines. For example, when I view my library in timeline, images with missing Exif date tags are not displayed.




To remedy this, I wrote a Python script to fix the dates in my photo library. It uses , which is a wrapper around the photo metadata library.



The scipt will:



* recursively scan a directory tree for jpg and png files



* get each file's creation time



* convert it to a timestamp string



* set Exif.Image.DateTime tag to timestamp



* set Exif.Photo.DateTimeDigitized tag to timestamp



* set Exif.Photo.DateTimeOriginal tag to timestamp



* save file with modified metadata



* set file access and modified times to file creation time



* Note: it does modifications in-place.



The :



via Planet Python
Full Post

No comments:

Post a Comment