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)
Make sure convert is at my location of where the data is saved
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"
Create a .gif video of the graph
saveGIF({ + for (i in 1:10) plot(runif(10), ylim = 0: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
I encountered the same problem. Imposing a short file path solved the error for me.
path.to.convert <- paste0(shortPathName(
"C:\\Program Files\\ImageMagick-6.9.0-Q16\\"), "convert.exe")
ani.options(convert=path.to.convert)
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"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With