Created
December 23, 2019 12:08
-
-
Save matt-dray/d44b715f9fe06949cc4cc0352aa61d06 to your computer and use it in GitHub Desktop.
Use {magick} to read 'before' and 'after' images to a gif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(magick) | |
before <- image_read("~/Desktop/before.png") | |
before <- image_crop(before, "815x300-80-200") | |
after <- image_crop(image_read("~/Desktop/after.png")) | |
after <- image_crop(after, "815x300-80-200") | |
# To morph | |
# frames <- image_morph(c(before, after, before), frames = 20) | |
# image_animate(frames) | |
# To animate | |
img <- c(before, after) | |
ani <- image_animate(image_scale(img, "x200"), fps = 1, dispose = "previous") | |
image_write(ani, "~/Desktop/animation.gif") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment