Overlay png image in corner of png image

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;}
```

```{r}
library(magick)

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(
  img_inset,
  operator = "Atop",
  gravity = "SouthWest",
  offset = "-10-10"
)

image_write(img_with_inset, "img_with_inset.png")
```

# A rose in a rose
```{r}
knitr::include_graphics("img_with_inset.png")
```

1 Like