Last data update: 2014.03.03

R: Resize an image
resizeR Documentation

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

Name of image 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.

Examples

if (interactive()) {
  # Can be chained with webshot() or appshot()
  webshot("http://www.google.com/", "google-small-1.png") %>%
    resize("75%")

  # Generate image that is 400 pixels wide
  webshot("http://www.google.com/", "google-small-2.png") %>%
    resize("400x")
}

Results