r-rust / gifski

R wrapper for the 'gifski' Rust Cargo crate.
Other
73 stars 4 forks source link

First pass at streaming encoder #7

Open jeroen opened 6 years ago

jeroen commented 6 years ago

@thomasp85 Example of calling the API:

library(gifski)
gif_file <- tempfile(fileext = ".gif")
gifski_encoder <- gifski_encoder_init(gif_file)

for(i in 1:10){
  pngfile <- tempfile(fileext = '.png')
  png(pngfile)
  plot(rnorm(i * 10), main = i)
  dev.off()
  framenum <- gifski_encoder(pngfile)
  cat("Added frame: ", framenum, "\n")
  unlink(pngfile)
}

out <- gifski_encoder(NULL)
utils::browseURL(out)