Similar to the ImageMagick composite
utility: compose an image on top of another one using a
CompositeOperator.
image_composite(image, composite_image = image[1], operator = "atop",
offset = "0x0", compose_args = "")image_border(image, color = "lightgray", geometry = "10x10",
operator = "copy")
image_frame(image, color = "lightgray", geometry = "25x25+6+6")
magick image object returned by image_read()
or image_graph()
composition image
string with a composite operator
geometry string with offset
additional arguments needed for some composite operations
a valid color string such as
"navyblue"
or "#000080"
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"
.
Basically image_border creates a slighly larger solid color frame and then composes the image 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).
Other image: analysis
,
animation
, attributes
,
color
, device
,
editing
, effects
,
index
, ocr
,
painting
, transform
# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab