Error Saving .gif video using windows with animation library
kcb4365640 opened this issue · comments
Hello. I am trying to create a simple .gif video using Windows 7. I installed ImageMagick and it seems to be working by itself. Below 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.
Kevin
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
Hi, Kevin @kcb4365640
This error message is the same as #46, I think 8863e18 fixed this bug, please try to install the development version.
# install the development version
install.packages('devtools')
library(devtools)
install_github("yihui/animation")
library(animation)
saveGIF({for (i in 1:10) plot(runif(10), ylim = 0:1)})
If you find the code above works on your Windows 7 system, please let us know. After you verify, Yihui will publish the stable release.
I am now able to save a .gif video after using this version. Thank you.
Kevin
Date: Sat, 29 Nov 2014 06:22:01 -0800
From: notifications@github.com
To: animation@noreply.github.com
CC: kcb4365640@hotmail.com
Subject: Re: [animation] Error Saving .gif video using windows with animation library (#55)
Hi, Kevin
This error message is the same as #46, I think 8863e18 fixed this bug, please try to install the development version.
install the development version
install.packages('devtools')
library(devtools)
install_github("yihui/animation")
library(animation)
saveGIF({for (i in 1:10) plot(runif(10), ylim = 0:1)})
If you find the code above works on your Windows 7 system, please let us know. After you verify, Yihui will publish the stable release.
—
Reply to this email directly or view it on GitHub.
=
When I do the following :
# install the development version
install.packages('devtools')
library(devtools)
install_github("yihui/animation")
library(animation)
saveGIF({for (i in 1:10) plot(runif(10), ylim = 0:1)})
I get this error:
Error in curl::curl_fetch_disk(url, x$path, handle = handle) :
Couldn't resolve host name
Can someone please help me?
Hi @Jeet1994 ,
The error shows that you network is not good. Please try again later.
Thanks for replying @yulijia . I must point out that my network is perfectly okay. I have good download speeds.
As an alternative, I tried downloadiing the animation-development.zip and then install it.
And even after that, I got the following error:
I cannot find ImageMagick with convert = "convert"
but I can find it from the Registry Hive: C:\Program Files\ImageMagick-7.0.2-Q16
Executing:
""C:\Program Files\ImageMagick-7.0.2-Q16\convert.exe" -loop 0 -delay 1 Rplot1.png
Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png
Rplot9.png Rplot10.png Rplot11.png Rplot12.png Rplot13.png Rplot14.png Rplot15.png
Rplot16.png Rplot17.png Rplot18.png Rplot19.png Rplot20.png Rplot21.png Rplot22.png
Rplot23.png Rplot24.png Rplot25.png Rplot26.png Rplot27.png Rplot28.png Rplot29.png
Rplot30.png Rplot31.png Rplot32.png Rplot33.png Rplot34.png Rplot35.png Rplot36.png
Rplot37.png Rplot38.png Rplot39.png Rplot40.png Rplot41.png Rplot42.png Rplot43.png
Rplot44.png Rplot45.png Rplot46.png Rplot47.png Rplot48.png Rplot49.png Rplot50.png
Rplot51.png Rplot52.png Rplot53.png Rplot54.png Rplot55.png Rplot56.png Rplot57.png
Rplot58.png Rplot59.png Rplot60.png Rplot61.png Rplot62.png Rplot63.png Rplot64.png
Rplot65.png Rplot66.png Rplot67.png Rplot68.png Rplot69.png Rplot70.png Rplot71.png
Rplot72.png Rplot73.png Rplot74.png Rplot75.png Rplot76.png Rplot77.png Rplot78.png
Rplot79.png Rplot80.png Rplot81.png Rplot82.png Rplot83.png Rplot84.png Rplot85.png
Rplot86.png Rplot87.png Rplot88.png Rplot89.png Rplot90.png Rplot91.png Rplot92.png
Rplot93.png Rplot94.png Rplot95.png Rplot96.png Rplot97.png Rplot98.png Rplot99.png
Rplot100.png "Sepal_ani.gif""
'"C:\Program Files\ImageMagick-7.0.2-Q16\convert.exe"' 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
There were 50 or more warnings (use warnings() to see the first 50)
Please look into the matter.
@Jeet1994 Sorry to the delayed reply. If you use Windows 10 and install the recent version of ImageMagick, it doesn't install convert.exe
in default, please see this thread. In order to use animation
package, you should re-install ImageMagick with "legacy" utilities, and you can run the example successfully. I have tested the develop version with ImageMagick-7.0.3-Q16.
If you still have problem on this, please feel free to contact me.
Lijia
@yulijia I tried it today and I get a similar results even when using the legacy features... weird
@yulijia I basically installed the legacy features of imagemagick, ran a saveGIF function and got the same message that jeet1994 got.
@dwkwvss do you use the develop version animation package? could you find convert.exe on your software folder?
@yulijia Yes. Convert.exe seems to be there, and I installed the developer version. Although I wonder if i have to first get rid of the original first?
library(animation)
packageVersion("animation")
Show me the version.
I will check it in 2 days.
@dwkwvss I try install R, Rstudio, animation and imagemagick in a new Windows 10 laptop. In the laptop those imagemagick programs (see pictures below) are installed.
Then open Rstudio and try use saveGIF()
, it works well.
If you see the error message as jeet1994, please re-open the Rstudio/R again.
I don't know why, but it works for me.
Hello, I have a similar problem:
`> ani.options("convert")
[1] "/Applications/ImageMagick-7.0.3/bin/convert"
saveGIF({
- for (i in 1:10) plot(runif(10), ylim = 0:1)
- })
Executing:
/Applications/ImageMagick-7.0.3/bin/convert -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'
an error occurred in the conversion... see Notes in ?im.convert`
It is not working. The version is the 2.4.1
Thanks.
which convert
/usr/local/bin/convert
Could you show me the convert
software location in the terminal?
I install ImageMagick
by Homebrew
, I couldn't find any ImageMagick Software in my Applications folder.
alevax:XXX alevax$ which convert
/Applications/ImageMagick-7.0.3/bin/convert
I installed the binary release downloaded from here:
http://www.imagemagick.org/script/binary-releases.php
I modified the PATH and the LIB PATH accordingly to the instruction on the download website.
And it is working from the console:
alevax:XXX alevax$ convert -h Version: ImageMagick 7.0.3-5 Q16 x86_64 2016-10-18 http://www.imagemagick.org Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC HDRI
Just want to make sure you set the environment successfully in the .bashrc
or .bash_profile
please open a new terminal window and type convert --help
in the terminal, could you see the help info as usual? And by the way, please restart Rstudio after set the ImageMagick environment.
I am checking if the animation
package can recognize the software installed in the Applications folder. It will take 1 ~ 2 days, keep in touch.
Thanks.
@yulijia Yes, I can see the help, I attached part of the output in the previous comment because it's a long help summary to paste.
In the ~/bash_profile I set:
export MAGICK_HOME="/Applications/ImageMagick-7.0.3" export PATH="$MAGICK_HOME/bin:$PATH" export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
Thanks for the help!
@alevax I uninstalled the ImageMagick and reinstalled the binary release, after set the environment as yours, I got a error message in figure shown below (dyld: Library not loaded).
my test code is
library(animation)
ani.options(convert="/Users/lijia/ImageMagick-7.0.3/bin/convert")
saveGIF({
for (i in 1:10) plot(runif(10), ylim = 0:1)
})
Exported dyld path doesn't seem satisfying the security of the OS.
There are two ways to fix it. One is copy all the /ImageMagick-7.0.3/lib
files to /usr/local/lib
.
The other is Disable System Integrity Protection.
Besides, I strongly suggest you use MacPorts (or Homebrew) to install ImageMagick. Both of them could custom build ImageMagick in your environment.
I install pretty much everything on Mac using Homebrew. It is just so much easier and convenient.
@yulijia I have already the content of the lib/ directory of ImageMagic in the path /usr/local/lib.
It is not a matter of loading the .dylib because I do not have the same error message that you got in the screenshot.
@alevax Sorry to make you confused. In fact, the convert
program in the binary release version (ImageMagick-7.0.3) cannot works on Mac OS X.
You can try convert any jpg picture to png format and will get a error message as shown below.
[lijia@17:29 ~] /Users/lijia/ImageMagick-7.0.3/bin/convert 9098.jpg 9098.png
Abort trap: 6
That's why you couldn't using it to generate gif picture with animation
package.
For the bug, you can read this thread "Abort trap 6"
I am sorry that I cannot help you with your problem, please try use ImageMagick 6.9.6-4
.
@yulijia Thanks for the help. I just installed via homebrew the version before the 7 and it is working.
Error in magick::image_read(files, strip = TRUE) :
unused argument (strip = TRUE)
@yulijia
I guess it is because strip
option only works under ImageMagick original convert. In our develop version, we introduce magick
package to help R user to avoid install ImageMagick by themselves. Also, I think there might be a small bug in the saveGIF
function that we cannot switch gif convert directly by the parameter. I will fix it when I am available.
So, please try to use https://github.com/thomasp85/gganimate package, the author already implement a better solution (with gifski
) to generate animations.