Saves a recolored image from a recolorize object to a PNG. This is done by calling recoloredImage and png::writePNG.
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.
Examples
# \donttest{
img <- system.file("extdata/corbetti.png", package = "recolorize")
rc <- recolorize2(img, cutoff = 45)
#>
#> Using 2^3 = 8 total bins
# 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")
#> [1] TRUE
# }