Created
September 22, 2016 13:42
-
-
Save Robinlovelace/9d9844886ec186c4423b611e6185392e to your computer and use it in GitHub Desktop.
Quick demo of averaging two images with the magick R package
This file contains hidden or 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) | |
library(magrittr) | |
# create raster layers | |
oldlogo <- image_read("https://developer.r-project.org/Logo/Rlogo-2.png") | |
newlogo <- image_read("https://www.r-project.org/logo/Rlogo.png") | |
oldlogo_blue = image_colorize(image = oldlogo, opacity = 99, color = "blue") %>% | |
image_blur(radius = 10, sigma = 10) | |
newlogo_red = image_colorize(image = newlogo, opacity = 99, color = "red") %>% | |
image_blur(radius = 10, sigma = 10) %>% | |
image_rotate(degrees = 90) | |
logos = c(oldlogo_blue, newlogo_red) | |
image_average(logos) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment