-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
mkimg.py
66 lines (51 loc) · 1.36 KB
/
mkimg.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
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------
# (c) kelu124
# cc-by-sa/4.0/
#
# Library for tagging images
# Definitely not optimized
#
# -------------------------
'''Description: Autotagging images for the `20180813a` experiment.'''
__author__ = "kelu124"
__copyright__ = "Copyright 2018, Kelu124"
__license__ = "cc-by-sa/4.0/"
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'
import os.path
# Path
path = os.getcwd().split("/")[-1]
Imgs = []
for dirpath, dirnames, filenames in os.walk("."):
for filename in [f for f in filenames if ( f.endswith(".jpg") or f.endswith(".png") )]:
Imgs.append( os.path.join(dirpath, filename) )
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'] = "matty,mux,myapo"
# Experiment
metadata['Exif.Image.Make'] = path
metadata['Exif.Photo.MakerNote'] = "Testing un0rick with max14866 mux with myapo"
# Description
metadata['Exif.Image.ImageDescription'] = "Testing the mux"
# Saving the image
metadata.write()
print("Image "+FileName+" saved")