image_modify_rgb_v: Modify R, G, B Values according to V values

Description Usage Arguments Details

View source: R/image_modify_rgb_v.R

Description

While the image_modify_rgb function modifies R, G, B with reference to the original values, image_modify_rgb_v also takes into account the brightness (V) values. It is similar to those apps which divide an image into a bright part and a dark part (and, for example, you can increase red in the bright part and decrease red in the dark part.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
image_modify_rgb_v(
  x,
  fun_r = NULL,
  fun_g = NULL,
  fun_b = NULL,
  alpha = FALSE,
  rescale_v = NULL,
  result = "magick",
  res = 144
)

Arguments

x

an image created by magick::image_read or other functions in package magick.

fun_r, fun_g, fun_b

a function or a list which designates an internal curve. See the Details part of image_modify_hsv.

alpha

whether to allow the output colors have transparency. Default is FALSE.

rescale_v

You can rescale the V values before modifying colors. A desired range of V values can be given, e. g., rescale_v = c(0.2, 1) which will make the smallest original value to be 0.2, and the largest, 1. Alternatively, it can be your own scaling function.

result

the default is "magick", the output is a magick picture. When it is "raster", a matrix is created which can be use as a raster for ggplot2::annotation_raster.

res

when the result is a magick picture, the res parameter used by magick::image_graph. Default is 144.

Details

This function uses custom functions or internal curves to make modification. See the Details part of image_modify_hsv to know how to use them. Note: values will be coerced to be in the [0, 255] range with no warning. For example, the original value is 240 and it becomes 280 in the output, then it will be set to 255 automatically.


plothelper documentation built on July 2, 2020, 4:03 a.m.