使用PythonMagick调整动画GIF的大小

使用PythonMagick调整动画GIF的大小

问题描述:

我正在使用PythonMagick 0.9.3(无法切换到PIL)来调整图像大小。它适用于除动画GIF之外的所有内容。

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?

谢谢!

我想你必须迭代组成动画的所有图像,调整它们的大小,然后重新组合动画,如 this(PHP语言示例)

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)