-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
img.py
54 lines (40 loc) · 1.05 KB
/
img.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/python
import sys
import pyexiv2
import os
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
Imgs = []
for filename in os.listdir("./"):
if filename.endswith(".jpg"):
Imgs.append(os.path.join("./", filename))
if filename.endswith(".png"):
Imgs.append(os.path.join("./", filename))
print Imgs
for FileName in Imgs:
edit = 0
metadata = pyexiv2.ImageMetadata(FileName)
try:
metadata.read()
except IOError:
print "Not an image"
else:
# Modules
metadata['Exif.Image.Software'] = "elmo, tomtom, alt.tbo, doj, goblin, cletus"
# Description
metadata['Exif.Image.ImageDescription'] = "Testing the alt.tbo pulser with a simple piezo"
# Experiment
metadata['Exif.Image.Make'] = "20171111a"
# Type of picture
if "Spectre" in FileName:
metadata['Exif.Photo.MakerNote'] = "signal"
# Saving the image
metadata.write()
print "Image "+FileName+" saved"