The local_image() function

Create a tibble that contains heights of an image in pixels (one column as a string, the other as numerical values), then, create a gt table. Use text_transform() to insert a local test image (PNG) image with the various sizes.

dplyr::tibble(
  pixels = px(seq(10, 35, 5)),
  image = seq(10, 35, 5)
) |>
  gt() |>
  text_transform(
    locations = cells_body(columns = image),
    fn = function(x) {
      local_image(
        filename = test_image(type = "png"),
        height = as.numeric(x)
      )
    }
  )
pixels image
10px
15px
20px
25px
30px
35px