Created
May 2, 2011 17:24
-
-
Save mrdoob/951956 to your computer and use it in GitHub Desktop.
Create RGB image (A replacing B channel) out of RGBA image.
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
from PIL import Image | |
import glob, os | |
for infile in glob.glob( "*.png" ): | |
file, ext = os.path.splitext( infile ) | |
im = Image.open( infile ) | |
im.load() | |
r, g, b, a = im.split() | |
im2 = Image.merge("RGB", (r,g,a)) | |
im2.save( file + "_packed.png", "PNG" ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment