#!/usr/bin/python #James Parks #import sys import os import re ##def jpWalkTest(data, dirname, filesindir): def jpResize( thisFile ): filename, ext = os.path.splitext( thisFile ) fileParts = re.split( "_", filename ) if fileParts[-1] == "4K": newName = filename[0:-3] + "_2K" + ext if os.path.exists( newName ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 2048x2048 ' + newName ) newName = filename[0:-3] + "_1K" + ext if os.path.exists( newName ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 1024x1024 ' + newName ) newName = filename[0:-3] + "_512" + ext if os.path.exists( newName ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 512x512 ' + newName ) newName = filename[0:-3] + "_256" + ext if os.path.exists( newname ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 256x256 ' + newName ) newName = filename[0:-3] + "_icon" + ext if os.path.exists( newName ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 32x32 ' + newName ) elif fileParts[-1] == "2K": newName = filename[0:-3] + "_1K" + ext if os.path.exists( newName ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 1024x1024 ' + newName ) newName = filename[0:-3] + "_512" + ext if os.path.exists( newName ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 512x512 ' + newName ) newName = filename[0:-3] + "_256" + ext if os.path.exists( newname ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 256x256 ' + newName ) newName = filename[0:-3] + "_icon" + ext if os.path.exists( newName ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 32x32 ' + newName ) elif fileParts[-1] == "1K": newName = filename[0:-3] + "_512" + ext if os.path.exists( newName ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 512x512 ' + newName ) newName = filename[0:-3] + "_256" + ext if os.path.exists( newname ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 256x256 ' + newName ) newName = filename[0:-3] + "_icon" + ext if os.path.exists( newName ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 32x32 ' + newName ) elif fileParts[-1] == "512": newName = filename[0:-3] + "_256" + ext if os.path.exists( newname ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 256x256 ' + newName ) newName = filename[0:-3] + "_icon" + ext if os.path.exists( newName ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 32x32 ' + newName ) elif fileParts[-1] == "256": newName = filename[0:-3] + "_icon" + ext if os.path.exists( newName ) == False: os.system( 'convert -channel RGB +matte ' + thisFile + ' -resize 32x32 ' + newName ) elif fileParts[-1] == "icon": print "You're kidding right?"