Repository navigation
Expand file tree
/
Copy pathlib.py
More file actions
46 lines (42 loc) · 1.5 KB
/
Copy pathlib.py
File metadata and controls
46 lines (42 loc) · 1.5 KB
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
# -*- coding: utf-8 -*-
import os
def convertgray(imagename,resultname):
""" process an image and save the results in a file"""
path = os.path.abspath(os.path.join(os.path.dirname("__file__"),os.path.pardir))
path1 = path+"/Test/convertgray"
path2= path+"/Test/"+imagename
path3= path+"/Test/"+resultname
if imagename[-3:] == 'jpg':
cmmd = str(path1+" "+path2+" "+path2)
os.system(cmmd)
print 'processed', imagename
elif imagename[-3:] == 'bmp':
cmmd = str(path1+" "+path2+" "+path3)
os.system(cmmd)
print 'processed', imagename
elif imagename[-3:] == 'png':
cmmd = str(path1+" "+path2+" "+path3)
os.system(cmmd)
print 'processed', imagename
else:
print 'Cannot processed', imagename
def imagething(imagename,resultname):
""" process an image and save the results in a file"""
path = os.path.abspath(os.path.join(os.path.dirname("__file__"),os.path.pardir))
path1 = path+"/Test/imagething"
path2= path+"/Test/"+imagename
path3= path+"/Test/"+resultname
if imagename[-3:] == 'jpg':
cmmd = str(path1+" "+path2+" "+path2)
os.system(cmmd)
print 'processed', imagename
elif imagename[-3:] == 'bmp':
cmmd = str(path1+" "+path2+" "+path3)
os.system(cmmd)
print 'processed', imagename
elif imagename[-3:] == 'png':
cmmd = str(path1+" "+path2+" "+path3)
os.system(cmmd)
print 'processed', imagename
else:
print 'Cannot processed', imagename