Last active
January 6, 2020 17:06
-
-
Save dietercastel/03710b79328bafc3df60ea938c63c056 to your computer and use it in GitHub Desktop.
Convert black and white image to black & red.
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
# This script coverts a black & white image to an image with new colors. | |
from PIL import ImageOps, Image | |
imgPath = "testImg.png" | |
blackColor = (255,0,0,0) | |
whiteColor = (0,0,0,255) | |
img = Image.open(imgPath).convert("L") | |
# Black pxl, white pxl | |
newImg = ImageOps.colorize(img,blackColor,whiteColor) | |
#ImageOps.crop(newImg,border=55).show() | |
newImg.show() | |
newImg.save("Colorified.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment