dotfiles/scripts/tagCreatorPhotos
Geoffrey Frogeye ee178b7d57
nix: Make nix the root
Which means now I'll have to think about real prefixes in commit names.
2023-11-26 23:58:22 +01:00

20 lines
511 B
Plaintext
Executable file

#!/usr/bin/env nix-shell
#! nix-shell -i python3 --pure
#! nix-shell -p python3 python3Packages.piexif
import os
import sys
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)
exifDict["0th"][piexif.ImageIFD.Copyright] = creator.encode()
exifBytes = piexif.dump(exifDict)
piexif.insert(exifBytes, filename)