Overlay png image in corner of png image

I have 2 png map images. I would like to put one in the corner of the other. Is there any way to do this using R Markdown? I have previously created the images using leaflet.

Hi @Jonw!

I realize I may sound like a broken record here :sweat_smile:, but I think magick is definitely the ticket for this job:

title: "Picture-in-Picture!"
output: html_document

```{css, echo=FALSE}
body {background-color: #777; color: #fff;}


img <- image_read("https://i.imgur.com/esbT74s.png")
img_inset <- image_scale(img, "30%x") %>% 
  image_border("white", "5x5")

img_with_inset <- img %>% image_composite(
  operator = "Atop",
  gravity = "SouthWest",
  offset = "-10-10"

image_write(img_with_inset, "img_with_inset.png")

# A rose in a rose

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.