Description Usage Arguments Value Examples
This is a convenience function for applying magick functions that take an image as the first argument and return an image. It's fully vectorised, so you can set separate argument values for each image.
1 | image_func(stimuli, func, ...)
|
stimuli |
list of class stimlist |
func |
the function or a string with the short name of the magick function (e.g., "blur" for |
... |
arguments to pass to the function |
stimlist with new images
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | stimuli <- demo_stim()
# use magick::image_* functions
image_func(stimuli, "fill", color = "black", fuzz = 10,
gravity = "north", location = "+0+10") %>%
plot()
blur <- image_func(stimuli, "blur", 5, 3)
oilpaint <- image_func(stimuli, "oilpaint", radius = 5)
negate <- image_func(stimuli, "negate")
greenscreen <- image_func(stimuli, "transparent", color = "green", fuzz = 5)
colorize <- image_func(stimuli, "colorize", opacity = 50,
color = c("hotpink", "dodgerblue"))
sharpen <- image_func(stimuli, "contrast", sharpen = 1)
# load a logo image and superimpose it on each image
logo <- system.file("extdata/logo.png", package = "webmorphR") %>%
magick::image_read() %>%
magick::image_resize(100)
image_func(stimuli, "composite", logo, offset = "+10+10") %>% plot()
# use a self-defined function
testfunc <- function(image) {
image # just return the image unprocessed
}
test <- image_func(stimuli, testfunc)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.