recolorize_to_png {recolorize} | R Documentation |
Saves a recolored image from a recolorize object to a PNG. This is done by calling recoloredImage and png::writePNG.
recolorize_to_png(recolorize_obj, filename = "")
recolorize_obj |
A recolorize object. |
filename |
Filename for saving the PNG. |
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.
No return value; saves a PNG file to the specified location.
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")