使用PythonMagick调整动画GIF的大小 [英] Resize animated GIF with PythonMagick

查看:227
本文介绍了使用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)

这篇关于使用PythonMagick调整动画GIF的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆