diff options
Diffstat (limited to 'impattern.py')
| -rwxr-xr-x | impattern.py | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/impattern.py b/impattern.py deleted file mode 100755 index 95c4def..0000000 --- a/impattern.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/Python27/python.exe
-#/usr/bin/python
-
-import downloader
-import filenamer
-import inventnamer
-import fieldstorager
-
-print "Content-Type: text/html"
-print
-print ""
-
-nametag = "imDither"
-
-MAIN_DIRECTORY = ""
-#BIN_CONVERT = "/usr/bin/convert"
-#BIN_IDENTIFY = "/usr/bin/identify"
-#BIN_COMPOSITE = "/usr/bin/composite"
-BIN_CONVERT = "convert"
-BIN_IDENTIFY = "identify"
-BIN_COMPOSITE = "composite"
-
-PARAM_LIST = "theurl, thedither, username, format"
-
-form = cgi.FieldStorage()
-newvalues = fieldstorager.fieldstorage(PARAM_LIST, form)
-thekeys = PARAM_LIST.split()
-for key in thekeys:
- globals()[key] = newvalues[key]
-
-if username == None:
- username = ""
-
-format = format
-if format == None:
- format = "png"
-
-class Dither():
- def file_size (self, file)
- return os.stat(file)[6]
- def identify(self, thefile):
- ident = Popen([BIN_IDENTIFY, thefile], stdout=PIPE).communicate()[0]
- partz = ident.split(" ")
- self.dimensions = partz[2].split("x")
- def makeCanvas(self, dimensions, thefile):
- os.system(BIN_CONVERT+" "-size "+self.dimensions[0]+"x"+self.dimensions[1]+" canvas:transparent"+thefile)
- def makeMask(self, themask, thedither, thebackground):
- os.system(BIN_CONVERT+" -tile "+thedither+" "+thebackground+" "+themask)
- os.system("rm "+thebackground)
- def fuseMask(self, themask, theimage):
- os.system(BIN_CONVERT+" "+themask+" null: "+theimage+" -matte -compose DstIn -layers composite "+theimage)
- os.system("rm "+themask)
- def init(self, theurl, thedither, username):
- self.mainfile = filenamer.filename(theurl, "imDither", username)
- filepaths = hexdirer.hexdir
- self.privatepath = filepaths[0]
- self.publicpath = filepaths[1]
- downloader.download(theurl, self.mainfile, self.privatepath)
- self.canvasfile = inventnamer.inventname("png", "canvasfile")
- self.dimensions = self.identify(self.mainfile)
- self.makeCanvas(self.dimensions, self.canvasfile)
- self.theMask = inventnamer.inventname("png", "maskfile")
- self.makeMask(self.theMask, thedither, self.canvasfile)
- self.fuseMask(self.theMask, self.mainfile)
- #self.mainfile = self.mainfile.replace(, do something with s3)
- print self.mainfile
- print self.file_size(self.mainfile)
- print 'width: '+self.dimensions[0]+'px'
- print 'height: '+self.dimensions[1]+'px'
-daddy = Dither(theurl, thedither, username)
\ No newline at end of file |
