Last data update: 2014.03.03

R: Shrink file size of a PNG
shrinkR Documentation

Shrink file size of a PNG

Description

This does not change size of the image in pixels, nor does it affect appearance – it is lossless compression. This requires the program optipng to be installed.

Usage

shrink(filename)

Arguments

filename

Name of image to shrink. Must be a PNG file.

Details

If other operations like resizing are performed, shrinking should occur as the last step. Otherwise, if the resizing happens after file shrinking, it will be as if the shrinking didn't happen at all.

Examples

if (interactive()) {
  webshot("http://www.google.com/", "google-shrink.png") %>%
    shrink()
}

Results