使用R动画库和Imagemagick保存gif视频时出错 [英] Error saving gif video with R animation library and Imagemagick

查看:246
本文介绍了使用R动画库和Imagemagick保存gif视频时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Windows 7创建一个简单的.gif视频。我安装了ImageMagick,它似乎独立工作。以下是我尝试运行的以下代码以及相应的错误消息。当我运行代码时,ImageMagik程序打开,看起来第一次运行的数据被绘制(见下图)。我怀疑问题是Windows和Unix命令之间的差异?也许我需要在ani.options中添加更多内容?任何帮助或建议将不胜感激。谢谢。

I am trying to create a simple .gif video using Windows 7. I installed ImageMagick and it seems to be working by itself. Here is the following code I tried to run and the corresponding error message. When I run the code the ImageMagik program opens up and it looks like the data for the first run is plotted (see image below). I suspect the problem is differences between windows and Unix commands? Perhaps I need to add more to the ani.options? Any help or suggestions would be greatly appreciated. Thank you.


添加所需的库



库(动画)

Add libraries needed

library(animation)

ani.options(convert ='C:/程序文件/ ImageMagick-6.8.9-Q16 / convert.exe')
ani.options(转换)#检查短手记法是否有效

ani.options(convert = 'C:/Program Files/ImageMagick-6.8.9-Q16/convert.exe') ani.options("convert")#check to see if short hand notation works

[1]C:/ Program Files / ImageMagick-6.8.9-Q16 / convert.exe

[1] "C:/Program Files/ImageMagick-6.8.9-Q16/convert.exe"


创建图形的.gif视频



saveGIF({
+ for(i in 1:10)plot(runif(10), ylim = 0:1)
+})

Create a .gif video of the graph

saveGIF({ + for (i in 1:10) plot(runif(10), ylim = 0:1) + })

执行:
C:/ Program Files / ImageMagick -6.8.9-Q16 / convert.exe-loop 0 -delay 100
Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png
Rplot7.png Rplot8.png Rplot9 .png Rplot10.pnganimation.gif
'C:/ Program'未被识别为内部或外部命令,
可操作程序或批处理文件。
输出地址:animation.gif
[1] TRUE
警告信息:
1:运行命令'C:\ Windows \ system32 \ cmd.exe / c C:/ Program Files / ImageMagick-6.8.9-Q16 / convert.exe-loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9。 png Rplot10.pnganimation.gif'状态为1
2:在cmd.fun(转换):
'C:/ Program Files / ImageMagick-6.8.9-Q16 / convert.exe -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.pnganimation.gif'执行失败,错误代码1

Executing: "C:/Program Files/ImageMagick-6.8.9-Q16/convert.exe" -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "animation.gif" 'C:/Program' is not recognized as an internal or external command, operable program or batch file. Output at: animation.gif [1] TRUE Warning messages: 1: running command 'C:\Windows\system32\cmd.exe /c "C:/Program Files/ImageMagick-6.8.9-Q16/convert.exe" -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "animation.gif"' had status 1 2: In cmd.fun(convert) : '"C:/Program Files/ImageMagick-6.8.9-Q16/convert.exe" -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "animation.gif"' execution failed with error code 1

推荐答案

我遇到了同样的问题。短路诀窍就是这样!但是使用Image Magick Version 7.x,不再有convert.exe。以下作品:

I had the same problem. The short path trick does it! But With Image Magick Version 7.x there no longer is a "convert.exe". The following works:

ani.options(convert=shortPathName("C:\\Program Files\\ImageMagick\\magick.exe"))

这篇关于使用R动画库和Imagemagick保存gif视频时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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