-
I need to paste a transparent image over a new image canvas made with pillow . But it automatically adds a black background in the output image . Can anyone help me to fix this ? Below is my code . from PIL import Image, ImageDraw, ImageFont , ImageOps , ImageColor
image = Image.new('RGB', (250,400), 'red')
image = ImageOps.expand(image,border=4,fill='black')
icon = Image.open('icon.png')
image.paste(icon ,(150,295))
image.save("output.png") |
Beta Was this translation helpful? Give feedback.
Answered by
radarhere
Nov 28, 2021
Replies: 2 comments 2 replies
-
In the interest of giving you a quick answer, I suggest trying this - image.paste(icon ,(150,295), icon) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
httpanand
-
OMG Thanks <3 . @radarhere |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the interest of giving you a quick answer, I suggest trying this -