Sunday, 27 October 2019

How to make gif from circular masked images?

Download Zip with Images

I have a folder with circular masked png images:

enter image description here enter image description here enter image description here

Usually I use this code to make gifs:

import imageio
import os

imglist = []
images = []
path = ('\\').join(__file__.split('\\')[:-1]) + '\\' + 'images\\'
for r, _, f in os.walk(path):
    for i in f:
        imglist.append(r + i)

for filename in imglist:
    if filename.endswith('.png'):
        images.append(imageio.imread(filename))

frames_per_second = 24
gifpath = ('\\').join(__file__.split('\\')[:-1]) + '\\' + 'GIF.gif'
imageio.mimsave(gifpath, images, duration = 1/frames_per_second)

This works fine for ordinary images but it seems to ignore masked images. The gif looks like this:

enter image description here

Any idea how to make a circular gif?



from How to make gif from circular masked images?

No comments:

Post a Comment