fx: Image FX

Description Usage Arguments See Also Examples

Description

Apply a custom an fx expression to the image.

Usage

1
image_fx(image, expression = "p", channel = NULL)

Arguments

image

magick image object returned by image_read() or image_graph()

expression

string with an fx expression

channel

a value of channel_types() specifying which channel(s) to set

See Also

Other image: _index_, analysis, animation, attributes, color, composite, device, edges, editing, effects, geometry, morphology, ocr, options, painting, segmentation, transform, video

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Show image_fx() expression
if(magick_config()$version > "6.8.8"){
img <- image_convert(, colorspace = "Gray")
image_fx(img, expression = "pow(p, 0.5)")
image_fx(img, expression = "random()")

gradient_x <- image_convolve(img, kernel = "Prewitt")
gradient_y <- image_convolve(img, kernel = "Prewitt:90")
gradient <- c(image_fx(gradient_x, expression = "p^2"),
                image_fx(gradient_y, expression = "p^2"))
gradient <- image_flatten(gradient, operator = "Plus")
gradient <- image_fx(gradient, expression = "sqrt(p)")
gradient
}

ropensci/magick documentation built on Jan. 15, 2019, 3:27 a.m.