Skip to content

Instantly share code, notes, and snippets.

Created May 19, 2015 15:16
Show Gist options
  • Save anonymous/41a31df9da14fa20cf26 to your computer and use it in GitHub Desktop.
Save anonymous/41a31df9da14fa20cf26 to your computer and use it in GitHub Desktop.
bashgenerator_2015_05_19_17-16
def generate(from_file, x, y, filenames, type='.png'):
filenames = filenames.split()
yield "# this file is generated automatically."
yield "convert {0} local01.miff".format(from_file)
for i, filename in enumerate(filenames):
l = "convert local01.miff -crop {0}x{1}+{2}+0 {3}{4}"
yield l.format(x, y, i*x, filename, type)
yield "rm local01.miff"
icons = "VTX V2X XALL BIX PERP CCEN EXM"
file_strings = generate("RENDERED_icons.png", 32, 32, icons)
for l in file_strings:
print(l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment