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.
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
)
an image created
by magick::image_read
or
other functions in package magick.
set r values with specific values.
add specific values to current R values.
multiply the current values with specific values.
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.
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
.
parameters to change G values. Used in the same way as those for R. See above.
parameters to change B values. Used in the same way as those for R. See above.
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
.
when the result is a magick picture, the
res
parameter used by magick::image_graph
.
Default is 144.
Several internal curves can be used.
Please see the Details part
of image_modify_hsv
.