Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Can't draw (draw_circle etc) on grayscale image #163

Description

@adam-cornwell

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions