Skip to content

Instantly share code, notes, and snippets.

@Chris2048
Created November 25, 2015 23:09
Show Gist options
  • Save Chris2048/ed8bbb995ed846a13f12 to your computer and use it in GitHub Desktop.
Save Chris2048/ed8bbb995ed846a13f12 to your computer and use it in GitHub Desktop.
Misc Code...
import os
import png
IMG_DIR = './static/img/'
for _, _, files in os.walk(IMG_DIR):
for file in files:
if file.endswith('.png'):
with open(IMG_DIR + file, 'r+') as f:
height, width = png.Reader(f).read()[:2]
f.seek(0) # reset pointer
png.Writer(height, width).write_array(f, [200 for i in range((height * width * 3))])
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment