Ixxie
Ixxie

Reputation: 1473

Suppressing output from ImageMagick when calling function from the R Animation package

I am using the saveGIF function of the Animation package in R, and would like to suppress the output it produces. I already tried invisible(); my guess is that this doesn't work because the Animation package uses ImageMagick to do its conversions.

The output I get looks something like this:

> sim()
Executing: 
convert -loop 0 -delay 10 /tmp/RtmpUhU5cn/Rplot1.png
    /tmp/RtmpUhU5cn/Rplot2.png /tmp/RtmpUhU5cn/Rplot3.png
    /tmp/RtmpUhU5cn/Rplot4.png /tmp/RtmpUhU5cn/Rplot5.png
    /tmp/RtmpUhU5cn/Rplot6.png /tmp/RtmpUhU5cn/Rplot7.png
    /tmp/RtmpUhU5cn/Rplot8.png /tmp/RtmpUhU5cn/Rplot9.png
    /tmp/RtmpUhU5cn/Rplot10.png '/home/ixxie/Code/R/fnord.gif'
Output at: /home/username/Code/R/fnord.gif

And the relevant code snippet looks like this:

invisible(saveGIF({for(i in 1:Tim) WFplot(A,X,Y,i)}, interval=0.1,clean=TRUE,ani.width=500,ani.height=500,movie.name="fnord.gif"))

Upvotes: 1

Views: 140

Answers (1)

jbaums
jbaums

Reputation: 27388

You can wrap your saveGIF call in suppressMessages. For example:

suppressMessages(saveGIF({
  for (i in 1:10) plot(runif(10), ylim = 0:1)
}))

Upvotes: 1

Related Questions