Skip to content

Instantly share code, notes, and snippets.

from PIL import Image, ImageSequence
def webp2gif(data):
img = Image.open(io.BytesIO(data))
frames = []
for frame in ImageSequence.Iterator(img):
im2 = Image.new("RGB", frame.size, (255, 255, 255))
im2.paste(frame, mask=frame.split()[3])
frames.append(im2.convert('RGB').convert(