image_keep_color {plothelper}R Documentation

Keep Some Colors Unchanged and Make Others into Grayscale

Description

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.

Usage

image_keep_color(x, color = NULL, fuzz = 10, result = "magick")

Arguments

x

an image read into R by magick::image_read.

color

the same as magick::image_transparent. You can use 1 or more colors.

fuzz

the same as magick::image_transparent. However, Its length must either be 1 or the same as color.

result

if it is "magick" (default), the result is a magick image, if it is "raster", the result is a matrix.


[Package plothelper version 0.1.9 Index]