composite: Image Composite

Description Usage Arguments Details See Also Examples

Description

Similar to the ImageMagick composite utility: compose an image on top of another one using a CompositeOperator.

Usage

1
2
3
4
5
6
7
image_composite(image, composite_image, operator = "atop",
  offset = "+0+0", compose_args = "")

image_border(image, color = "lightgray", geometry = "10x10",
  operator = "copy")

image_frame(image, color = "lightgray", geometry = "25x25+6+6")

Arguments

image

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

composite_image

composition image

operator

string with a composite operator from compose_types()

offset

a geometry_point string to set x/y offset of top image

compose_args

additional arguments needed for some composite operations

color

a valid color string such as "navyblue" or "#000080"

geometry

a geometry string to set height and width of the border, e.g. "10x8". In addition image_frame allows for adding shadow by setting an offset e.g. "20x10+7+2".

Details

The image_compose function is vectorized over both image arguments: if the first image has n frames and the second m frames, the output image will contain n * m frames.

The image_border function creates a slightly larger solid color frame and then composes the original frame on top. The image_frame function is similar but has an additional feature to create a shadow effect on the border (which is really ugly).

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Compose images using one of many operators
imlogo <- image_scale(image_read("logo:"), "x275")
rlogo <- image_read("https://developer.r-project.org/Logo/Rlogo-3.png")

# Standard is atop
image_composite(imlogo, rlogo)

# Same as 'blend 50' in the command line
image_composite(imlogo, rlogo, operator = "blend", compose_args="50")

# Add a border frame around the image
image_border(imlogo, "red", "10x10")
image_frame(imlogo)

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