Created
February 18, 2013 17:30
-
-
Save bibliotechy/4979053 to your computer and use it in GitHub Desktop.
Takes the output of running pngnq on a file and returns it to its original filename.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Filename: denq.py | |
from os import path | |
import shutil | |
import sys | |
def main(): | |
if sys.argv: | |
base = sys.argv[1] #get the filename from shell | |
fullpath = path.split(base) | |
filename = fullpath[1].split('-')[0] #pngng creates files with -nq before the .png | |
#now move the quantized photo to replace the existing photo | |
shutil.move(base,fullpath[0]+'/'+filename+".png") | |
else: | |
print "No file supplied, quitting" | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment