-
-
Save tazjel/2663956 to your computer and use it in GitHub Desktop.
Image Blender
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
# Take r, g and b channels from separate images. Python randomises the list for extra fun. | |
from PIL import Image | |
import os, math, sys, random | |
os.chdir(sys.argv[1]) | |
fileList = os.listdir(".") | |
random.shuffle(fileList) | |
(width, height) = Image.open(fileList[0]).size | |
nPhotos = len(fileList) | |
dst = Image.new("RGB", (width, height)) | |
fileNum = 0 | |
rkeep, g, b = Image.open(fileList[fileNum]).split() | |
fileNum = fileNum + 1 | |
r, gkeep, b = Image.open(fileList[fileNum]).split() | |
fileNum = fileNum + 1 | |
r, g, bkeep = Image.open(fileList[fileNum]).split() | |
Image.merge("RGB", (rkeep, gkeep, bkeep)).save("testbgr.jpg", "JPEG") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment