if (interactive() && requireNamespace("EBImage")) {
# Load the EBImage package
library(pliman)
# Load a sample RGB image
img <- image_pliman("soybean_touch.jpg")
# 50% transparency
image_alpha(img, 0.5) |> plot()
# transparent background
mask <- image_binary(img, "NB")[[1]]
img_tb <- image_alpha(img, mask)
plot(img_tb)
}
Run the code above in your browser using DataLab