recolorize_to_png {recolorize}R Documentation

Save a recolored image as a PNG

Description

Saves a recolored image from a recolorize object to a PNG. This is done by calling recoloredImage and png::writePNG.

Usage

recolorize_to_png(recolorize_obj, filename = "")

Arguments

recolorize_obj

A recolorize object.

filename

Filename for saving the PNG.

Details

This function saves a png with the same dimensions (in pixels) as the image that was originally provided to recolorize (meaning if you resized your original image, the resulting PNG will also be smaller). Anything more complicated can be created with custom scripts: for example, you could create a vector image using recolorizeVector, and then save this as a PNG of any resolution/size.

Value

No return value; saves a PNG file to the specified location.

Examples


img <- system.file("extdata/corbetti.png", package = "recolorize")
rc <- recolorize2(img, cutoff = 45)

# save a PNG:
recolorize_to_png(rc, "corbetti_recolored.png")

# remove the PNG (so this example doesn't spam your working directory)
file.remove("corbetti_recolored.png")



[Package recolorize version 0.1.0 Index]