Skip to content

Instantly share code, notes, and snippets.

@xiaody
Forked from w0rm/convert-png-to-rgba.py
Created May 12, 2014 05:23
Show Gist options
  • Save xiaody/c20dcf9cdf61bd10ccd1 to your computer and use it in GitHub Desktop.
Save xiaody/c20dcf9cdf61bd10ccd1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#
# Script to convert png files to RGBA color space
# Requires Pillow (pip install Pillow)
#
import os
import fnmatch
from PIL import Image
for root, dirnames, filenames in os.walk('sprites'):
for filename in fnmatch.filter(filenames, '*.png'):
image_path = os.path.join(root, filename)
print image_path
Image.open(image_path).convert('RGBA').save(image_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment