Palettized blitting? #6527
-
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. |
Beta Was this translation helpful? Give feedback.
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") |
Beta Was this translation helpful? Give feedback.
It sounds to me like you're just describing
paste()
withbox
andmask
arguments, and acrop()
operation.Using https://github.com/python-pillow/Pillow/blob/main/Tests/images/transparent.png,
gives