Created
September 16, 2021 08:02
-
-
Save GordonOus/59fca5ca60689e2c99c71a4217868f6f to your computer and use it in GitHub Desktop.
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 numpy as np | |
from PIL import Image | |
img1 = Image.open('lemur.png') | |
img2 = Image.open('flag.png') | |
n1 = np.array(img1)*255 | |
n2 = np.array(img2)*255 | |
#our images have a mode of RGB which is assumed to be an 8-bit int | |
n_image = np.bitwise_xor(n1, n2).astype(np.uint8) | |
#Convert to PIL image and save | |
Image.fromarray(n_image).save('n.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment