Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

animation package cannot find ImageMagick with convert = "convert"

I have run animations in the past up to 2 weeks ago on Windows 7, R 3.0.1. Today I loaded R 3.0.2 and needed to download the animations package to run make an animation. After doing so when I try to run the animation (here is a script) I get the following error:

> saveGIF(FUN2(), interval = 0.1, outdir = "images/animate")
I cannot find ImageMagick with convert = "convert"
NULL
Warning messages:
1: running command 'convert --version' had status 4 
2: In im.convert(img.files, output = movie.name, convert = convert,  :
  ImageMagick not installed yet!

I have ImageMagick installed and on the path as demonstrated in the video I made of the problem: http://www.youtube.com/watch?v=gvpawqLyCZY&feature=youtu.be

I can run convert --version in the Windows command line and get the following:

C:\Users\trinker>convert --version
Version: ImageMagick 6.8.6-8 2013-08-04 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib djvu fftw fontconfig freetype jng jp2 jpeg lcms lzma openexr pa
ngo png ps tiff webp x xml zlib

Yet running system("convert --version") in R yields:

Invalid drive specification.
Warning message:
running command 'convert --version' had status 4 

What am I doing wrong or might I alter to make the animation package (and R) see ImageMagick?

Here is additional information for the problem (in the R command line I get):

> system("convert -version")
Invalid drive specification.
Warning message:
running command 'convert -version' had status 4 

> shell("convert --version")
Version: ImageMagick 6.8.7-9 Q16 x64 2013-11-28 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps tiff webp xml zlib
like image 371
Tyler Rinker Avatar asked Dec 09 '13 17:12

Tyler Rinker


2 Answers

I had a similar issue with the {rgl} movie3d() function. In that case you can explicitly pass a convert string to be executed, and so can 'tell' R where to find the right convert.exe:

imconvertstring<-"\"c:\\Program Files\\ImageMagick-6.9.0-Q16\\convert.exe\" -delay 1x%d %s*.png %s.%s"

movie3d(spin3d(),duration=10,convert=imconvertstring)

You can do the same with the {animation} package using ani.options() to specify the exact location to convert.exe needed. See the help entry for im.convert() in the {animation} package.

like image 106
sosaworks Avatar answered Oct 12 '22 12:10

sosaworks


I don't know how many people know this.

There is already a program called convert in newer versions of windows that does something with filesystems. After installing Imagemagick I renamed the IM convert and used that to make system calls. I haven't used the animation package yet so I can't speak to the best way to solve this particular problem.

like image 32
cylondude Avatar answered Oct 12 '22 12:10

cylondude