dotfiles/scripts/tagCreatorPhotos

20 lines
511 B
Plaintext
Raw Normal View History

#!/usr/bin/env nix-shell
#! nix-shell -i python3 --pure
#! nix-shell -p python3 python3Packages.piexif
2018-08-07 16:09:41 +02:00
import os
2023-11-23 22:59:09 +01:00
import sys
2018-08-07 16:09:41 +02:00
import piexif
assert len(sys.argv) >= 3, "Usage {} CREATOR FILENAMES...".format(sys.argv[0])
creator = sys.argv[1]
filenames = sys.argv[2:]
for filename in filenames:
assert os.path.isfile(filename)
exifDict = piexif.load(filename)
2021-06-13 11:49:21 +02:00
exifDict["0th"][piexif.ImageIFD.Copyright] = creator.encode()
2018-08-07 16:09:41 +02:00
exifBytes = piexif.dump(exifDict)
piexif.insert(exifBytes, filename)