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

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

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

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