Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

resize

Resize an image


Description

This does not change size of the image in pixels, nor does it affect appearance – it is lossless compression. This requires GraphicsMagick (recommended) or ImageMagick to be installed.

Usage

resize(filename, geometry)

Arguments

filename

Character vector containing the path of images to resize.

geometry

Scaling specification. Can be a percent, as in "50%", or pixel dimensions like "120x120", "120x", or "x120". Any valid ImageMagick geometry specifation can be used. If filename contains multiple images, this can be a vector to specify distinct sizes for each image.

Examples

if (interactive()) {
  # Can be chained with webshot() or appshot()
  webshot("https://www.r-project.org/", "r-small-1.png") %>%
    resize("75%")

  # Generate image that is 400 pixels wide
  webshot("https://www.r-project.org/", "r-small-2.png") %>%
    resize("400x")
}

webshot

Take Screenshots of Web Pages

v0.5.2
GPL-2
Authors
Winston Chang [aut, cre], Yihui Xie [ctb], Francois Guillem [ctb], Barret Schloerke [ctb], Nicolas Perriault [ctb] (The CasperJS library)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.