Skip to content

Instantly share code, notes, and snippets.

@karthik
Created January 12, 2017 19:16
Show Gist options
  • Save karthik/901ca5273d45da2c2004fb3659a78b2b to your computer and use it in GitHub Desktop.
Save karthik/901ca5273d45da2c2004fb3659a78b2b to your computer and use it in GitHub Desktop.
library(magick)
# Package and issues available at: https://github.com/ropensci/magick
# -------------------------------------------------------------------------
wizard_hat <- image_read("http://i.imgur.com/rpJ09lY.png") %>%
image_scale("x100")
bigdata <-
image_read('https://i.imgur.com/6X65Els.jpg') %>%
image_scale("x300")
hadley <-
image_read("https://i.imgur.com/e3As6XR.jpg") %>%
image_scale("x250")
start <-
image_composite(bigdata, image_fill(hadley, "none", fuzz = 5000), offset = "+100+80")
images <- lapply(seq(from = -100, to = 30, by = 10), function(i) {
image_composite(start, image_scale(wizard_hat, "x100"), offset = paste0("+185+", i))
})
image_animate(image_join(images), loop = 5)
# Sorry Hadley!
image_read("http://i.imgur.com/Y8JUQsV.gif") %>% image_scale("x250")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment