View source: R/image_keep_color.R
This function keeps pixels with certain
colors unchanged and transforms
others into grayscale.
The function is in fact a wrapper of
magick::image_transparent
, so it
uses the latter's color
and fuzz
parameters. NOTE: the function only works
for fully opaque or fully
transparent (labelled as "transparent") pixels.
1 | image_keep_color(x, color = NULL, fuzz = 10, result = "magick")
|
x |
an image read into R
by |
color |
the same
as |
fuzz |
the same
as |
result |
if it is "magick" (default), the result is a magick image, if it is "raster", the result is a matrix. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.