yihui / animation

A gallery of animations in statistics and utilities to create animations
https://yihui.org/animation/
206 stars 60 forks source link

Using saveGIF: error occurred in the conversion #103

Closed weianuk closed 7 years ago

weianuk commented 7 years ago

I tried the following codes to use saveGIF function in my RStudio,

library(animation)
# Sys.getenv("PATH", "C:\\Program Files\\ImageMagick-7.0.6-Q16")
ani.options(convert = 'C:\\PROGRA~1\\ImageMagick-7.0.6-Q16\\convert.exe')
saveGIF({
  for (i in 1:10) plot(runif(10), ylim = 0:1)
})

But it gives the error below:

convert.exe: unable to load module 'C:\Program Files\ImageMagick-7.0.6-Q16\modules\coders\IM_MOD_RLPNG.dll': The specified module could not be found. @ error/module.c/OpenModule/1266. convert.exe: no decode delegate for this image format PNG' @ error/constitute.c/ReadImage/509. convert.exe: no images definedanimation.gif' @ error/convert.c/ConvertImageCommand/3275.

Is there something wrong in my setting? Tried the solutions from previous threads, e.g. ADMIN running, but still error. Hope for helps on my problem. @yulijia @yihui
Thanks in advance.

yulijia commented 7 years ago

Could you mind re-install ImageMagick, from the error message, I think ImageMagick is not installed correctly. Also the R environment cannot find convert.exe in your computer.

weianuk commented 7 years ago

@yulijia thanks. Just re-installed ImageMagick, and already set the PATH again: Sys.getenv("PATH", "C:\Program Files\ImageMagick-7.0.6-Q16"). but it still has the error below:

'C:\PROGRA~1\ImageMagick-7.0.6-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

yulijia commented 7 years ago

Could you find convert.exe in your ImageMagick directory? If not, that's because you don't install it.

weianuk commented 7 years ago

Problem solved now.

There is no convert.exe. Imagemagick 7 uses the "magick" command in place of "convert". Therefore, use saveGIF should call magick.exe rather than convert.exe if IM7 was installed.

It is suggested the ani.options documentation could be updated for this.

yulijia commented 7 years ago

Thanks, we will include magick on dev #98