Places a magick-image overlay onto a background image at a specified
position and opacity.
Arguments
- background
A path to an image file, a URL, or a
magick-imageobject to use as the background.- overlay
A
magick-imageobject to overlay, typically the output ofrender_hud()orwarp_hud().- x
Horizontal pixel offset of the overlay's top-left corner from the background's top-left. Defaults to
0.- y
Vertical pixel offset of the overlay's top-left corner from the background's top-left. Defaults to
0.- opacity
A number in
[0, 1]controlling the overlay's transparency.1is fully opaque,0is invisible. Default is0.85.- operator
ImageMagick compositing operator. Default
"over". Seemagick::image_composite()for the full list of operators.- ...
Additional arguments (currently unused, but reserved for future extensions).
Examples
if (FALSE) { # \dontrun{
library(ggplot2)
bg <- magick::image_read("photo.jpg")
p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
img <- render_hud(p, width = 400, height = 280)
out <- composite_hud(bg, img, x = 50, y = 30, opacity = 0.8)
magick::image_browse(out)
} # }
