-
-
Save pillar/fb3746b623c483dd2a9631fcf8e46f1b to your computer and use it in GitHub Desktop.
Create RGB image (A replacing B channel) out of RGBA image.
This file contains hidden or 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