-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
56 lines (39 loc) · 1.35 KB
/
main.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
import glob
import os
from clicpic import Clicpic
import sys
import getopt
def renameJPGs():
# Command line arguments... ignore this
inputFile = Clicpic.camera_path + 'headings.txt'
imageCounter = 0
fileExtension = 'JPG'
# Where the actual work is done
newFileNames = openAndStore(inputFile)
files = sorted(glob.glob(Clicpic.camera_path + '*.' + fileExtension))
if not files or len(files) != len(newFileNames):
print("Different sizes!")
sys.exit(2)
for index in range(0, len(newFileNames)):
os.rename(files[index], Clicpic.unprocessed_path + newFileNames[index] + '.' + str(imageCounter) + ('.' + fileExtension))
imageCounter += 1
# input: input text file name
# output: list of new file names
def openAndStore(inputFile):
listNames = []
with open(inputFile) as file:
listNames = file.readline().split()
file.close()
return listNames
myClicpic = Clicpic()
# Point to directory of Images
# Must have or create a directory for processed images
# and for unprocessed images
os.chdir(Clicpic.unprocessed_path)
answer = "NO"
renameJPGs()
imageFilenameList = glob.glob("*")
if len(imageFilenameList) > 0:
for filename in imageFilenameList:
print("\n", Clicpic.unprocessed_path + filename)
myClicpic.clic2picXY(filename)