【问题标题】:gganimate unable to call ImageMagick correctly, possible path errorGanimate无法正确调用ImageMagick,可能的路径错误
【发布时间】:2017-04-28 23:53:39
【问题描述】:

我正在尝试在 Windows 7 中安装 gganimate。我已经添加了 ImageMagick 的路径,下面是我尝试安装它时使用的代码。

library(httr)
set_config(config(ssl_verifypeer = 0L))
library(devtools)
library(RCurl)
devtools::install_github("RcppCore/Rcpp")
devtools::install_github("dgrtwo/gganimate")
install.packages("gapminder")
library(gapminder)
library(ggplot2)
theme_set(theme_bw())
p <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, color =continent,   frame = year)) +
geom_point() +
scale_x_log10()

library(gganimate)

install.packages("cowplot")
install.packages("animation")
library(animation)
ani.options(convert = shQuote('C:/Program Files/ImageMagick-7.0.3-  Q16/magick.exe'))
gganimate(p)

但在运行最后一行 gganimate(p) 后出现以下错误: Error

错误是:

执行: ""\"C:/程序 文件/ImageMagick-7.0.3-Q16/magick.exe\"" -loop 0 -dispose none -delay 0 plot1.png -dispose 上一个 -延迟 100 plot2.png plot3.png plot4.png plot5.png plot6.png plot7.png plot8.png plot9.png plot10.png plot11.png plot12.png plot13.png "fileb4835f936f2.gif"" 文件名、目录名或卷标语法不正确。 转换中发生错误...请参阅 ?im.convert 中的注释 文件错误(文件,“rb”):无法打开连接 另外:警告信息: 1:运行命令 'C:\Windows\system32\cmd.exe /c "\"C:/Program Files/ImageMagick-7.0.3-Q16/magick.exe\"" --version' 状态为 1 2:运行命令'C:\Windows\system32\cmd.exe /c ""\"C:/Program Files/ImageMagick-7.0.3-Q16/magick.exe\"" -loop 0 -dispose none -delay 0 plot1.png -dispose previous -delay 100 plot2.png plot3.png plot4.png plot5.png plot6.png plot7.png plot8.png plot9.png plot10.png plot11.png plot12.png plot13.png "fileb4835f936f2.gif" "' 状态为 1 3:在 cmd.fun(convert) 中: '""\"C:/Program Files/ImageMagick-7.0.3-Q16/magick.exe\"" -loop 0 -dispose none -delay 0 plot1.png -dispose previous -delay 100 plot2.png plot3.png plot4 .png plot5.png plot6.png plot7.png plot8.png plot9.png plot10.png plot11.png plot12.png plot13.png "fileb4835f936f2.gif""' 执行失败,错误代码为 1 4:运行命令'""\"C:/Program Files/ImageMagick-7.0.3-Q16/magick.exe\"" -loop 0 -dispose none -delay 0 plot1.png -dispose previous -delay 100 plot2.png plot3.png plot4.png plot5.png plot6.png plot7.png plot8.png plot9.png plot10.png plot11.png plot12.png plot13.png "fileb4835f936f2.gif""' 状态为 127 5:在文件中(文件,“rb”): 无法打开文件 'C:\Users\shammun\AppData\Local\Temp\RtmpuSfr4m/gganimate\fileb4835f936f2.gif':没有这样的文件或目录

【问题讨论】:

    标签: r gganimate


    【解决方案1】:

    使用ani.options 中的shortPathName 函数更改路径对我有用:

    magickPath <- shortPathName("C:\\Program Files\\ImageMagick-7.0.3-Q16\\magick.exe")
    ani.options(convert=magickPath)
    

    【讨论】:

    • 谢谢!在此之前 30 分钟一直在寻找解决方案 :)
    【解决方案2】:

    我发现路径名中的空格给我带来了问题。我从

    更改了路径名
    ani.options(convert = "C:/Program Files/ImageMagick-7.0.3-Q16/magick.exe")
    

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

    然后我又可以保存 GIF 动图了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-15
      • 2013-04-02
      • 1970-01-01
      • 1970-01-01
      • 2018-09-05
      • 1970-01-01
      • 2011-01-23
      • 1970-01-01
      相关资源
      最近更新 更多