我有一个包含大量 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 不完整:
此外,它会闪烁。我认为这是因为它将 image18 和 image180 视为连续的。我该如何解决?
我正在运行 Ubuntu 18
编辑:
由 xenoid 建议生成的新图像
最佳答案
*.png
展开排序 按字母顺序排列 通过你的外壳,所以如果你想要按编号顺序排列的帧,请用 0 填充名称: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 ...
关于linux - 使用 ImageMagick : too many exceptions and blinking problem 创建 GIF 图像时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60987165/