Resize animated GIF with PythonMagick

2019-08-08 17:36发布

问题:

I'm using PythonMagick 0.9.3 (cannot switch to PIL) to resize images. It works fine for everything except for animated GIFs.

This is the way how I resize the images at the moment:

orig_image = Image('path/to/animated.gif')
orig_image.resize('..resize string..')
orig_image.write('path/to/thumbnail.gif')

Currently it only resizes the first image of the sequence so the image is no longer animated afterwards. Does anyone have a workaround for my problem?

Thank you!

回答1:

I suppose you have to iterate on all the images that compose the animation, resize them, and recompose the animation after like this (with example for PHP language)