使用ImageMagick创建GIF图像时出现错误:异常过多和闪烁问题

问题描述 投票:0回答:1

我有一个目录,其中包含许多具有以下结构的png文件:

image1.png
image2.png
...
image3372.png

我正在尝试使用ImageMagick创建GIF图像,因此在终端中输入:

sudo apt-get install imagemagick
convert -delay 0.01 -loop 0 *.png myimage.gif

但是我有下一个错误:

...
convert-im6.q16: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c
/ConnectPixelCacheServer/244.
convert-im6.q16: cache resources exhausted `Image119.png' @ error/cache.c/OpenPixelCache/3984.
convert-im6.q16: too many exceptions (exception processing suspended).

并且创建的GIF不完整:enter image description here

而且,它闪烁。我认为这是因为它将image18和image180视为连续的。我该如何解决?

我正在运行Ubuntu 18

编辑:Xenoid建议生成的新图像enter image description here

linux image terminal imagemagick gif
1个回答
1
投票
  1. 100帧/秒是过大的。您可以以10帧/秒的速度运行,并将图像计数除以10(或至少标准25帧/秒,并除以4)。
  2. *.png由您的外壳展开并按字母顺序排序,因此,如果要按编号顺序排列帧,请用0填充名称:
  3. for n in {1..3372} ; ; do mv image$n.png image$(printf "%04d" $n).png ; done
    [convert(和其他IM命令)似乎使用了内存缓存,并具有其他强制实施的限制(可以使用IM的identify命令列出):
  • >>> identify -list resource Resource limits: Width: 16KP Height: 16KP List length: 18.446744EP Area: 128MP Memory: 256MiB Map: 512MiB Disk: 1GiB File: 768 Thread: 8 Throttle: 0 Time: unlimited
    您可以提高一次运行的限制:

    convert -limit memory 1000 ...

  • © www.soinside.com 2019 - 2024. All rights reserved.