invert | R Documentation |
Invert the brightness of each color channel in an image and/or circularly shifts the hue value. Optionally, a Gaussian blur can be applied.
invert(
img = NULL,
invert = TRUE,
colshift = 0,
blur = 0,
file.in = "",
file.out = "",
format = "png",
show.image = TRUE
)
img |
n-by-m-by-3 array or n-by-m-by-4 array representing an rgb(+alpha) image |
invert |
logical flag indicating whether the channel-brightness should be inverted |
colshift |
numerical value between 0 and 1 setting the circular shift of the hue value. If |
blur |
numerical value >=0 defining the standard deviation of an optional Gaussian blur. |
file.in |
optional input filename, which can be used to load an image instead of providing it via |
file.out |
optional output filename. |
format |
one of "png" or "jpg" specifying the file format of the input and output image. |
show.image |
logical flag specifying whether the image is displayed in the R console. |
Returns an n-by-m-by-3 array or n-by-m-by-4 array of the processed image.
Danail Obreschkow
img = yinyangyong # this is an example image included in the package
# invert brightness of all channels
invert(img)
# invert brightness, but preserve hue
invert(img, colshift=0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.