使用 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?

谢谢!

我想你必须遍历所有组成动画的图像,调整它们的大小,然后像 这个(以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)