Page MenuHomec4science

mmontage
No OneTemporary

File Metadata

Created
Fri, Nov 22, 09:25

mmontage

#!/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