Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error using Animation package R

Tags:

r

imagemagick

Tried to run the following code in R:

ani.options(
   convert = shQuote("C:/Program Files/ImageMagick-6.9.0-Q16/convert.exe")
)
 saveGIF(
{
  for (i in 1:10) plot(runif(10), ylim = 0:1)
},
 movie.name = "test.gif", 
interval = 0.2, 
ani.width = 300, 
ani.height = 300,
outdir = getwd()
)

Getting the error message:

Executing: 
"\"C:/Program Files/ImageMagick-6.9.0-Q16/convert.exe\"" -loop 0 -delay 20     Rplot1.png Rplot2.png Rplot3.png
Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "test.gif"
The filename, directory name, or volume label syntax is incorrect.
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-6.9.0-Q16/convert.exe\"" --version' had status 1 
2: running command 'C:\Windows\system32\cmd.exe /c "\"C:/Program Files/ImageMagick-6.9.0-Q16/convert.exe\"" -loop 0  -delay 20 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "test.gif"' had status 1 
3: In cmd.fun(convert) :
  '"\"C:/Program Files/ImageMagick-6.9.0-Q16/convert.exe\"" -loop 0  -delay 20 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "test.gif"' execution failed with error code 1
4: running command '"\"C:/Program Files/ImageMagick-6.9.0-Q16/convert.exe\"" -loop 0  -delay 20 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png     Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "test.gif"' had status 127 

Could someone please point on my mistake.

like image 312
user27241 Avatar asked Jun 19 '26 18:06

user27241


1 Answers

I had the same issue, and it seems it is due to the path to convert. If I type:

ani.options(convert = shQuote('C:/Program Files/ImageMagick-6.8.7-Q16/convert.exe'))

And then check the path

ani.options("convert") [1] "\"C:/Program Files/ImageMagick-6.8.7-Q16/convert.exe\""

However, if I do:

ani.options(convert = 'C:/Program Files/ImageMagick-6.8.7-Q16/convert.exe') ani.options("convert") [1] "C:/Program Files/ImageMagick-6.8.7-Q16/convert.exe"

It is the correct path and saveGIF works.... weird things...

like image 123
Francisco Abascal Avatar answered Jun 21 '26 09:06

Francisco Abascal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!