'How to center mixed size images when genetering a gif from these images using Python?

It is possible to generate a gif from a number of images with Python (such as imageio or PIL Image.save ). However, when the sizes of these images are different, how to make all the images align to the center of the gif using Python? The following code could not implement this:

imgList = []

for image in glob.glob(f'{dirName}/*'):
    imgList.append(imageio.imread(image))

imageio.mimsave(f'./{dirName}.gif', imgList)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source