Created
November 25, 2015 23:09
-
-
Save Chris2048/ed8bbb995ed846a13f12 to your computer and use it in GitHub Desktop.
Misc Code...
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
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