bm_resize | R Documentation |
Trim and/or extend bitmaps to a desired height and/or width.
bm_resize(
x,
value,
width = NULL,
height = NULL,
hjust = "center-left",
vjust = "center-top"
)
## S3 method for class 'bm_bitmap'
bm_resize(
x,
value = 0L,
width = NULL,
height = NULL,
hjust = "center-left",
vjust = "center-top"
)
## S3 method for class 'bm_list'
bm_resize(x, ...)
## S3 method for class 'bm_pixmap'
bm_resize(
x,
value = col2hex("transparent"),
width = NULL,
height = NULL,
hjust = "center-left",
vjust = "center-top"
)
## S3 method for class ''magick-image''
bm_resize(
x,
value = "transparent",
width = NULL,
height = NULL,
hjust = "center-left",
vjust = "center-top"
)
## S3 method for class 'nativeRaster'
bm_resize(
x,
value = col2int("transparent"),
width = NULL,
height = NULL,
hjust = "center-left",
vjust = "center-top"
)
## S3 method for class 'raster'
bm_resize(
x,
value = "transparent",
width = NULL,
height = NULL,
hjust = "center-left",
vjust = "center-top"
)
x |
Either a |
value |
Value for the new pixels. |
width |
How many pixels wide should the new bitmap be.
Use with the |
height |
How many pixels tall should the new bitmap be.
Use with the |
hjust |
One of "left", "center-left", "center-right", "right". "center-left" and "center-right" will attempt to place in "center" if possible but if not possible will bias it one pixel left or right respectively. "centre", "center", and "centre-left" are aliases for "center-left". "centre-right" is an alias for "center-right". |
vjust |
One of "bottom", "center-bottom", "center-top", "top". "center-bottom" and "center-top" will attempt to place in "center" if possible but if not possible will bias it one pixel down or up respectively. "centre", "center", and "centre-top" are aliases for "center-top". "centre-bottom" is an alias for "center-bottom". |
... |
Additional arguments to be passed to or from methods. |
This function is a convenience wrapper around bm_trim()
and bm_extend()
.
Depending on x
either a bm_bitmap()
, bm_font()
, bm_list()
, magick-image, "nativeRaster", bm_pixmap()
, or raster object.
bm_extend()
, bm_pad()
, and bm_trim()
.
font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
font <- read_hex(font_file)
# add a border to an "R"
capital_r <- font[[str2ucp("R")]]
print(capital_r)
capital_r <- bm_resize(capital_r, width = 12L, height = 12L, vjust = "top")
print(capital_r)
corn <- farming_crops_16x16()$corn$portrait
corn_rs <- bm_resize(corn, width = 20L, height = 20L, vjust = "top")
if (cli::is_utf8_output() && cli::num_ansi_colors() >= 256L) {
print(corn_rs, bg = "cyan", compress = "v")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.