Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92649286
mmontage
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 22, 09:25
Size
2 KB
Mime Type
text/x-python
Expires
Sun, Nov 24, 09:25 (2 d)
Engine
blob
Format
Raw Data
Handle
22477597
Attached To
rMTOOLS Mtools
mmontage
View Options
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
import
sys
,
os
import
glob
import
shutil
import
string
from
PIL
import
Image
from
PIL
import
ImageDraw
from
PIL
import
ImageFont
from
optparse
import
OptionParser
from
Mtools
import
*
####################################################################################
def
parse_options
():
####################################################################################
usage
=
"usage: %prog [options] file"
parser
=
OptionParser
(
usage
=
usage
)
parser
.
add_option
(
"-m"
,
"--mode"
,
action
=
"store"
,
dest
=
"mode"
,
type
=
"string"
,
default
=
'RGB'
,
help
=
"image mode : L, P or RGB"
)
parser
.
add_option
(
"-p"
,
"--parameterfile"
,
action
=
"store"
,
dest
=
"parameterfile"
,
type
=
"string"
,
default
=
None
,
help
=
"parameter file"
)
parser
.
add_option
(
"-o"
,
action
=
"store"
,
dest
=
"outputdirectory"
,
type
=
"string"
,
default
=
None
,
help
=
"output directory"
)
parser
.
add_option
(
"-d"
,
"--directory"
,
action
=
"store"
,
dest
=
"directory"
,
type
=
"string"
,
default
=
None
,
help
=
"image directory"
)
parser
.
add_option
(
"--cmd"
,
action
=
"store"
,
dest
=
"cmd"
,
type
=
"string"
,
default
=
None
,
help
=
"execute command"
)
(
options
,
args
)
=
parser
.
parse_args
()
return
args
,
options
####################################################################################
#
# MAIN
#
####################################################################################
files
,
opt
=
parse_options
()
files
=
[
files
]
# check parameter file
if
opt
.
parameterfile
!=
None
:
if
not
os
.
path
.
isfile
(
opt
.
parameterfile
):
raise
"parameter file
%s
does not exits !"
%
opt
.
parameterfile
if
opt
.
outputdirectory
!=
None
:
if
os
.
path
.
isdir
(
opt
.
outputdirectory
):
shutil
.
rmtree
(
opt
.
outputdirectory
)
os
.
mkdir
(
opt
.
outputdirectory
)
# execute
execfile
(
opt
.
parameterfile
)
Event Timeline
Log In to Comment