Skip to content

Instantly share code, notes, and snippets.

@migonzalvar
Created March 6, 2014 18:20
Show Gist options
  • Save migonzalvar/9396099 to your computer and use it in GitHub Desktop.
Save migonzalvar/9396099 to your computer and use it in GitHub Desktop.
Create a square image. Requires PIL (or pillow)
#!/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