Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80645811
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
Sun, Sep 1, 20:59
Size
2 KB
Mime Type
text/x-python
Expires
Tue, Sep 3, 20:59 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20414354
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