Created
March 6, 2014 18:20
-
-
Save migonzalvar/9396099 to your computer and use it in GitHub Desktop.
Create a square image. Requires PIL (or pillow)
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/env python | |
"""Create a square image. Usage: | |
$ imageholder.py filename size color | |
""" | |
import sys | |
from PIL import Image | |
def main(): | |
if len(sys.argv) != 4: | |
usage() | |
sys.exit() | |
filename, size, color = sys.argv[1:] | |
size = int(size) | |
make_image_holder(filename, size, color) | |
def usage(): | |
print(__doc__) | |
def make_image_holder(filename, size, color): | |
img = Image.new('RGBA', (size, size), color=color) | |
img.save(filename) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment