in drawing.R (https://github.com/dahtah/imager/blob/master/R/drawing.R) for the methods such as draw_circle(), the color to draw in is converted to red, green, and blue values. This then is checked against the length of the spectrum for the image to draw on. If the image is grayscale, that length is 1, but the size of the vector for the color to draw in is always 3, making it impossible to draw on grayscale images, even if the requested color is white, black, or grayscale.
Wouldn't it make more sense to first check the spectrum mode of the image, and then convert the requested draw color to that? So convert the draw color to grayscale, and then draw on the grayscale image.
For now, as a workaround, to do something simple like draw a white circle on a grayscale image I first have to create an RGB image of the same dimensions and black background using imfill, draw on that dummy image, and then combine that with my actual image.
in drawing.R (https://github.com/dahtah/imager/blob/master/R/drawing.R) for the methods such as draw_circle(), the color to draw in is converted to red, green, and blue values. This then is checked against the length of the spectrum for the image to draw on. If the image is grayscale, that length is 1, but the size of the vector for the color to draw in is always 3, making it impossible to draw on grayscale images, even if the requested color is white, black, or grayscale.
Wouldn't it make more sense to first check the spectrum mode of the image, and then convert the requested draw color to that? So convert the draw color to grayscale, and then draw on the grayscale image.
For now, as a workaround, to do something simple like draw a white circle on a grayscale image I first have to create an RGB image of the same dimensions and black background using imfill, draw on that dummy image, and then combine that with my actual image.