Last active
August 29, 2015 14:01
-
-
Save codingisacopingstrategy/1c5b82398895d3eb8c6e to your computer and use it in GitHub Desktop.
Creates mark-up for the images on http://i.liketightpants.net/and/
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 | |
# Creates mark-up for the images on http://i.liketightpants.net/and/ | |
import sys | |
from PIL import Image | |
picture = sys.argv[1] | |
try: | |
picture = int(picture) | |
print """<a href="/and/assets/that/are/screenshots/numbered/%04d.png"><img src="/and/assets/scaled/to/830/wide/that/are/screenshots/numbered/%04d.png" alt="" title="" /></a>""" % (picture, picture) | |
except ValueError: | |
image = Image.open(picture) | |
width = 830 | |
ratio = width / float(image.size[0]) | |
height = int( image.size[1] * ratio ) | |
print """<a href="/and/assets/called/%s"> | |
<img src="/and/assets/scaled/to/830/wide/and/called/%s" style="width:%spx;height:%spx;" alt="" title="" /> | |
</a>""" % (picture, picture, width, height) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment