Crop Circles

R
packages
Author

Aurélien Ginolhac

Published

February 20, 2023

From the repo on GitHub.

library(cropcircles)
suppressPackageStartupMessages(library(dplyr))
library(ggimage)
library(ragg)

# breaking bad images
x <- c(1, 3, 9, 8)
# initial fetch
#images <- glue::glue("https://openpsychometrics.org/tests/characters/test-resources/pics/BB/{x}.jpg")
images <- glue::glue("{x}.jpg")

# border colours
border_cols <- colorRampPalette(c("black", "brown4"))(4)
  
df <- tibble(y = 1:4, images = images) |> 
  mutate(images_circle = circle_crop(images, border_size = 16, border_colour = border_cols))

df |> 
  ggplot() +
  geom_image(aes(1.5, y, image = images), size = 0.15) +
  geom_image(aes(3.5, y, image = images_circle), size = 0.15) +
  xlim(0, 5) +
  ylim(0, 5) +
  coord_fixed()