Repository navigation
Palettized blitting? #6527
Answered
by
radarhere
TheRealQuantam
asked this question in
Q&A
|
Is there a good way of blitting palettized Pillow Images? Specifically, this requires the ability to paste a palettized image with some kind of transparency (either a transparent palette entry or an RGBA palette with binary A values) at a specified place on another image with the same palette? Bonus points if you can also paste a section (rather than the whole) of the source image. |
Answered by
radarhere
Aug 23, 2022
Replies: 1 comment 2 replies
|
It sounds to me like you're just describing Using https://github.com/python-pillow/Pillow/blob/main/Tests/images/transparent.png, from PIL import Image
im = Image.open("transparent.gif")
im2 = im.crop((0, 0, 100, 100))
im.paste(im2, (50, 50), im2.convert("LA"))
im.save("out.png") |
2 replies
Answer selected by
radarhere
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

It sounds to me like you're just describing
paste()withboxandmaskarguments, and acrop()operation.Using https://github.com/python-pillow/Pillow/blob/main/Tests/images/transparent.png,
gives