Learn R Programming

Rvision (version 0.4.2)

border: Add Border to Image

Description

border adds a border to an image.

Usage

border(
  image,
  top,
  bottom = top,
  left = top,
  right = top,
  border_type = "constant",
  border_color = "black"
)

Arguments

image

An Image object.

top, bottom, left, right

The width in pixels of the border on each side of the image. By default, bottom, left and right are set to the same value as top.

border_type

A character string indicating the extrapolation method to use when filling empty pixels created during the transformation. It can be any of the following:

  • "constant" (the default):iiiiii|abcdefgh|iiiiii with i specified by border_value.

  • "replicate":aaaaaa|abcdefgh|hhhhhh.

  • "reflect":fedcba|abcdefgh|hgfedc.

  • "wrap":cdefgh|abcdefgh|abcdef.

  • "reflect_101":gfedcb|abcdefgh|gfedcb.

  • "transparent":uvwxyz|abcdefgh|ijklmn.

border_color

A value or vector of any kind of R color specification compatible with col2bgr representing the color of the border (default: "black").

Value

An Image object.

See Also

Image

Examples

Run this code
# NOT RUN {
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
balloon_border <- border(balloon, 10)
plot(balloon_border)

# }

Run the code above in your browser using DataLab