R {animation}软件包[saveGIF]-想要使用magick而不是convert [英] R {animation} package [saveGIF] - want to use magick instead of convert

查看:125
本文介绍了R {animation}软件包[saveGIF]-想要使用magick而不是convert的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据一系列R绘图制作GIF动画文件。我安装了ImageMagick和动画程序包。

I want to make a GIF animation file from a series of R plots. I installed ImageMagick and "animation" package to do this.

我想使用 saveGIF 函数,但是当我使用该函数,它将尝试在ImageMagick中使用 convert.exe 并给出错误。看起来当前版本的ImageMagick使用 magick.exe 而不是 convert.exe convert.exe 不存在)。

I want to use saveGIF function, but when I uses the function, it tries to use convert.exe in ImageMagick and gives an error. It looks like the current version of ImageMagick uses magick.exe instead of convert.exe (convert.exe does not exist).

我能够使用 magick.exe 直接从ImageMagick制作GIF动画,而无需使用动画包。但是如果我可以使saveGIF使用 magick.exe 而不是 convert.exe ,对我来说更方便。我想知道该怎么做。

I was able to make a GIF animation directly from ImageMagick using magick.exe without using the animation package. But it is more convenient for me if I can make saveGIF to use magick.exe instead of convert.exe. I want to know how to do it.

安装仍使用 convert.exe 的I​​mageMagick的较旧版本会解决问题,但这不是我要的答案。

Installing an older version of ImageMagick that still uses convert.exe would solve the problem, but this is not an answer I am looking for.

我尝试了 ani.options 建议乔什·奥布莱恩(Josh O'Brien)着。以下是我得到的。不确定是什么问题...

I tried ani.options suggested by Josh O'Brien. Below is what I got. Not sure what the problem is...

> ani.options(convert = 'C:/Program Files/ImageMagick-7.0.5-Q16/magick.exe')
> 
> saveGIF(
+ for(i in 1:10){
+ plot(i,1,xlim=c(0,11))
+ }
+ )
Executing: 
"C:/Program Files/ImageMagick-7.0.5-Q16/magick.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.
an error occurred in the conversion... see Notes in ?im.convert
[1] FALSE
Warning messages:
1: running command 'C:\WINDOWS\system32\cmd.exe /c "C:/Program Files/ImageMagick-7.0.5-Q16/magick.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-7.0.5-Q16/magick.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
3: running command '"C:/Program Files/ImageMagick-7.0.5-Q16/magick.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 127 


推荐答案

Josh O'Brien的答案奏效。 程序文件必须更改为 PROGRA〜1。

Josh O'Brien's answer worked. "Program Files" had to be changed to "PROGRA~1".

ani.options(convert = 'C:/PROGRA~1/ImageMagick-7.0.5-Q16/magick.exe')

saveGIF(
for(i in 1:10){
plot(i,1,xlim=c(0,11))
}
)

这篇关于R {animation}软件包[saveGIF]-想要使用magick而不是convert的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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