Created
January 20, 2018 18:43
-
-
Save beothorn/77a2cfd1f27d4adb9eb813dd347a9bb0 to your computer and use it in GitHub Desktop.
Enhances shadows from given image args: original destination brightness
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, ImageFilter, ImageChops, ImageEnhance | |
import sys | |
original_img = sys.argv[1] | |
dest_img = sys.argv[2] | |
mask_strength = sys.argv[3] | |
original = Image.open(original_img) | |
gray = original.convert("LA") | |
blurred = gray.filter(ImageFilter.GaussianBlur(radius=5)) | |
blurred = blurred.convert("RGB") | |
enhancer = ImageEnhance.Brightness(blurred) | |
blurred = enhancer.enhance(float(mask_strength)) | |
multiplied= ImageChops.multiply(original, blurred) | |
multiplied.save(dest_img) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment