我想使用R的magick
库在.png图像的底部添加一个白色矩形。
白色矩形的尺寸
宽度:1200px
高度:50像素
我认为追加会很有用。然而,我不清楚如何创建,而不是读取白色矩形图像。具体来说,我如何在这个汽车图像的底部添加一个50像素高的白色矩形,并与图像的长度一致。
library("magick")
url <- "https://images.unsplash.com/photo-1604397707219-dfe825b8a59d"
使用image_blank
创建白色矩形。然后使用CCD_ 3对图像进行组合。
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))