Created
February 29, 2020 17:53
-
-
Save Vadbeg/2b8532cc7eff7068369009bd7be4bbfa 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
def add_backgound(image): | |
""" | |
Adds background to given image using PIL | |
""" | |
image_shape = image.shape | |
image_height = image_shape[0] | |
image_width = image_shape[1] | |
backgound = create_blank_image(image_height, | |
image_width, | |
rgb_color=(0, 0, 255)) | |
background = Image.fromarray(backgound) | |
image = Image.fromarray(image) | |
background.paste(image, | |
(0, 0), | |
image) | |
return background |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment