Generating RGB array of image consisting of rectangles

I've made it. Look at the end of the post.

I'm looking for a R library which will allow me to create an RGB array of an image consisting of multiple rectangles. Each rectangle has it's own color, position and transparency.

I should be able to define dimensions, and rectangles, and get RGB array representing image with defined rectangles.

I've read Raster and Imager vignettes and part of doc, but none seems to meet requirements.
Is it possible to do such thing in raster or imager, or should I use some other lib?

Thank you in advance!

I've found this

I've made it. I think code is pretty straight forward:

width <- height <- 300

cimg(array(1, c(width,height,1,3))) -> img1

x0 <- y0 <- 1
x1 <- y1 <- 40
draw_rect(img, x0, y0, x1, y1, opacity = 1, color="BLACK",filled = TRUE) -> img1

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.