dahtah/imager

Colour argument has wrong length

Closed this issue · 1 comments

Sorry for the stupid question, but what does this error message mean when using draw_text: colour argument has wrong length

I am basically using the example draw_text(boats,100,100,"Some text",col="black") %>% plot with a different picture. The picture has 4 colour channels instead of 3, as the boat picture does.

You must specify values of col explicitly for images having 4 color channels.

# add alpha channel to boats
a <- imfill(width(boats), height(boats))
b <- imlist(boats, a) %>% imappend("c")

# doesn't work
draw_text(b,100,100,"Some text",col="black") %>% plot

# work
draw_text(b,100,100,"Some text",col=c(0,0,0,0)) %>% plot