-
Notifications
You must be signed in to change notification settings - Fork 5
/
makepreview.py
47 lines (27 loc) · 945 Bytes
/
makepreview.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
import sys
import os
class MakePreview(object):
def __init__(self,DEBUG=False):
self.DEBUG = DEBUG
if self.DEBUG:
print "MakePreview() init successfull"
def makepreview(self,imagename):
if os.path.isfile("./{0}/{0}_PREVIEW.JPG".format(imagename)):
if self.DEBUG:
print "Preview image already exists, skipping."
return
cmd = "convert ./{0}/{0}_CORRECTED.TIF ./{0}/{0}_PREVIEW.JPG".format(imagename)
if self.DEBUG:
print "Creating preview image ..."
os.system(cmd)
if self.DEBUG:
print "... Done."
if __name__ == '__main__':
if len(sys.argv) != 2:
print "Usage:\n\tpython makepreview.py <imagename>"
else:
imagename = sys.argv[1]
print "Making RGB image preview ..."
mp = MakePreview()
mp.makepreview(imagename)
print "All Done."