image_modify_rgb: Modify R, G, B Values of an Image

Description Usage Arguments Details

View source: R/image_modify_rgb.R

Description

The function modifies the R, G, B values of an image and is used in the same way as image_modify_hsv in this package. The three channels can be modified separately. The ways to modify include: setting values to some specified values (set_*), adding (add_*), multiplying the original values (mult_*), rescaling the original values (rescale_*), using a function to recompute values (fun_*). The most useful way is to use some internal curves that mimic those PS-like apps.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
image_modify_rgb(
  x,
  set_r = NULL,
  add_r = NULL,
  mult_r = NULL,
  rescale_r = NULL,
  fun_r = NULL,
  set_g = NULL,
  add_g = NULL,
  mult_g = NULL,
  rescale_g = NULL,
  fun_g = NULL,
  set_b = NULL,
  add_b = NULL,
  mult_b = NULL,
  rescale_b = NULL,
  fun_b = NULL,
  result = "magick",
  res = 144
)

Arguments

x

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

set_r

set r values with specific values.

add_r

add specific values to current R values.

mult_r

multiply the current values with specific values.

rescale_r

a length 2 numeric vector specifying the desired range of R values, e. g., rescale_r = c(180, 240) which will make the smallest original value to be 180, and the largest, 240. Alternatively, it can be your own scaling function.

fun_r

your own modifying function (e. g., fun_r = sqrt). Alternatively, it can be a list that designates how to use internal curves. See image_modify_hsv.

set_g, add_g, mult_g, rescale_g, fun_g

parameters to change G values. Used in the same way as those for R. See above.

set_b, add_b, mult_b, rescale_b, fun_b

parameters to change B values. Used in the same way as those for R. See above.

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

Several internal curves can be used. Please see the Details part of image_modify_hsv.


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