Skip to content

Instantly share code, notes, and snippets.

@yihui
Last active July 13, 2017 20:53
Show Gist options
  • Save yihui/5899181 to your computer and use it in GitHub Desktop.
Save yihui/5899181 to your computer and use it in GitHub Desktop.
create and download a GIF animation in Shiny
library(animation)
stopifnot(packageVersion('animation') >= '2.2.3')
shinyServer(function(input, output) {
output$testgif = downloadHandler(
filename = 'random.gif',
content = function(file) {
saveGIF(
for (i in 1:30) {
plot(rnorm(100))
}, movie.name = 'random.gif', interval = 0.1)
file.rename('random.gif', file)
})
})
library(shiny)
shinyUI(basicPage(
downloadButton("testgif")
))
@kmezhoud
Copy link

Hi,
I just tried to save coffeewheel (https://github.com/armish/coffeewheel) as gif file.
animation needs ImageMagick?
Thanks

sh: convert: command not found
Error in cmd.fun(sprintf("%s --version", convert), intern = TRUE) :
error in running command
I cannot find ImageMagick with convert = 'convert'
Warning in run(timeoutMs) :
Please install ImageMagick first or put its bin path into the system PATH variable
Warning in run(timeoutMs) :
path[1]="animation.gif": No such file or directory
Error opening file: 2
Error reading: 9

@ian-flores
Copy link

I have the same issue as kmezhoud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment