Hi @Jonw!
This might be coming at the question a bit sideways, but since you already have PNG images, how about just adding borders, courtesy of ImageMagick and the magick
package? A very simple example on a dark background to make the effect obvious:
---
title: "Adding borders to PNGs`"
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_with_border <- image_border(img, "white", "20x20")
image_write(img, "img.png")
image_write(img_with_border, "img_with_border.png")
```
# Borderless
```{r}
knitr::include_graphics(c("img.png", "img.png"))
```
# With border
```{r}
knitr::include_graphics(c("img_with_border.png", "img_with_border.png"))
```
You could get more elaborate with the borders, too. The magick
compositing functions can do an awful lot when you put them together!