Cannot find 'convert' using SaveGIF functi

2019-01-28 04:39发布

问题:

I'm having trouble with the SaveGIF function in library (animation). The function gives me this error:

Error in cmd.fun(sprintf("%s --version", convert), intern = TRUE, ignore.stdout = !interactive(), :
unused argument(s) (ignore.stdout = !interactive())
I cannot find ImageMagick with convert = 'convert'
NULL
Warning message:
In im.convert(img.files, output = movie.name, convert = convert, :
Please install ImageMagick first or put its bin path into the system PATH variable

What confuses me is that I do have convert on my system, so I'd expect SaveGIF to be able to find it without any trouble:

me@my-laptop:~$ convert --version

Version: ImageMagick 6.5.7-8 2010-12-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009

How do I add convert's bin path to the system PATH variable?

Edit: I'm using Ubuntu, not Windows.

回答1:

You probably did not edit your PATH variable. On Windows 7 (but will probably work on earlier versions to) go to:

start menu

Right click computer -> properties

Advanced System Settings

Environment Variables

Then under "System variables" (the lower pane) find the variable "path", select it and click edit.

You are interested in the content of Variable value (maybe copy it to a text editor to read it better). It should contain the link to imagemagick in it, seperated by semicolons from other variables. For me the path to imagemagick is:

C:\Program Files\ImageMagick-6.6.7-Q16

Make sure you only add it, not change anything else to the path variable. Add it with a semicolon.



回答2:

Usually we do not need to manually set the PATH variable under Linux. I'm using Ubuntu as well, but I cannot reproduce your error. What's your R version?

> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] animation_2.0-4    

As far as I can see, the error comes from the function system() instead of not being able to find convert. The argument ignore.stdout came in R 2.12.1, so you must be using a lower version of R. The current version is 2.13.0, and I recommend you to upgrade to the latest version. See http://cran.r-project.org/bin/linux/ubuntu/ for how to keep R updated with CRAN.



回答3:

You can find where your convert function lives with system("which convert", intern=TRUE) and then you (may be able to) add that to your PATH variable with

Sys.setenv(PATH=...)



回答4:

After attempting all of these fixes as well as these and these to no success, I used alternative software to make the conversion from the png files that were successfully created with saveHTML. Several programs are described here. I am a Windows user and found the simple instructions contained in that site for VirtualDub quickly accomplished this task.