Add white rectangle to bottom of image with imageMagick in R

Use image_blank to create the white rectangle. Then combine the images using image_composite.

library(magick)
url <- "https://images.unsplash.com/photo-1604397707219-dfe825b8a59d"

img <- image_read(url)
white <- image_blank(1200, 50, "white")

x <- image_info(img)$width - 1200
y <- image_info(img)$height - 50

image_composite(img, white, offset = paste0("+", x, "+", y))

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top