Open mdsumner opened 10 months ago
img <- readPNG(system.file("img", "Rlogo.png", package="png"))
str(img)
# num [1:76, 1:100, 1:4] 0 0 0 0 0 0 0 0 0 0 ...
scales::alpha(img, .2)
#Error: colours encodes as numbers must be positive
str(scales::alpha(matrix(rgb(img[,,1], img[,,2], img[,,3], img[,,4]), nrow(img)), .2)
#chr [1:7600] "#00000033" "#00000033" "#00000033" "#00000033" "#00000033" "#00000033" "#00000033" ...
--
create a scales::alpha() for arrays, hex, rgb, nativeRaster that doesn't drop dimension