Learn R Programming

ggpattern (version 0.1.3)

fill_area_with_img_none: Resize image canvas to the target width/height, and use gravity to place the undistorted image

Description

Unless the width and height are carefully chosen, this operation will distort the image to force it to fit the dimensions

Usage

fill_area_with_img_none(
  img,
  width,
  height,
  gravity = "Center",
  filter = "lanczos",
  scale = 1
)

Arguments

img

magick image

width

target dimensions for final image

height

target dimensions for final image

gravity

how to anchor the image during the operation. See magick::gravity_types()

filter

default: lanczos

scale

scale the source image before tiling. default: 1

Value

magick image of the required dimensions

Examples

Run this code
# NOT RUN {
filename <- system.file("img", "Rlogo.png", package="png")
img <- magick::image_read(filename)
fill_area_with_img_none(img, 100, 400)
# }

Run the code above in your browser using DataLab