addCopyright.py 1.07 KB
Newer Older
1
#Generic script that add all metadata ti what ever pic this only on JPG images, PNG  supported GLib.Error: GExiv2: unsupported format (501)
2
3
4
from gi.repository import GExiv2
import glob

5
6
7
8
9
10

fileImageListTIF=glob.glob("/home/jesus/git/wsm.rest/imageProcessing/tmp3/original/tif/*.tif")
fileImageListJPG=glob.glob("/home/jesus/git/wsm.rest/imageProcessing/tmp3/original/jpg/*.jpg")

fileImageList = fileImageListTIF + fileImageListJPG

11
for image in fileImageList:
12
    print("Doing:%s" % image)
13
14
15
16
17
18
19
20
21
22
23
    metadata = GExiv2.Metadata(image)
    #print metadata.get_exif_tags()
    #for tag in metadata.get_exif_tags():
    #    print tag,":", metadata[tag]

    metadata.set_tag_string("Exif.Image.Copyright","ISRIC - CC BY 4.0 http://creativecommons.org/licenses/by/4.0/")
    metadata.set_tag_string("Exif.Image.Artist","ISRIC - Theo Jacobs")
#metadata.set_tag_string("Exif.Image.ImageDescription","WOSIS:63670,ISIS:AU002")
#metadata.set_comment("WOSIS:63670,ISIS:AU002,WRB2004:Solonetzs")
#metadata.set_tag_string("Iptc.Application2.Keywords","Test,Foo")   # Doesnt work  
    metadata.save_file()
24
print("Done")