相关疑难解决方法(0)

调整GIF动画大小,pil/imagemagick,python

我想使用python和PIL或PythonMagick更改GIF动画图像的大小.我找不到解决方案.PIL和缩略图方法适用于jpg和png但不适用于gif.ImageMagick有命令mogrify/convert -resize'1280x1024>'但我找不到文档,我不知道如何用pythonmagick做到这一点.

谁知道解决方案?

在最坏的情况下,我使用os/subprocess并转换; -S

谢谢.

python imagemagick gif python-imaging-library pythonmagick

7
推荐指数
1
解决办法
7987
查看次数

如何在PIL中缩放动画GIF图像并保留动画

我想知道是否可以使用PIL缩放动画GIF图像.特别是Plone的原型ImageField目前从使用其缩放方法缩放的图像中丢失动画:

def scale(self, data, w, h, default_format = 'PNG'):
    """ scale image (with material from ImageTag_Hotfix)"""
    #make sure we have valid int's
    size = int(w), int(h)

    original_file=StringIO(data)
    image = PIL.Image.open(original_file)
    # consider image mode when scaling
    # source images can be mode '1','L,','P','RGB(A)'
    # convert to greyscale or RGBA before scaling
    # preserve palletted mode (but not pallette)
    # for palletted-only image formats, e.g. GIF
    # PNG compression is OK for RGBA thumbnails
    original_mode = image.mode
    img_format = image.format and …
Run Code Online (Sandbox Code Playgroud)

python plone image image-processing python-imaging-library

6
推荐指数
2
解决办法
4824
查看次数