View source: R/ray_write_image.R
ray_write_image | R Documentation |
Takes an RGB array/filename and writes it to file.
ray_write_image(image, filename, clamp = TRUE, ...)
image |
Image filename or 3-layer RGB array. |
filename |
File to write to, with filetype determined by extension. Filetype can be
|
clamp |
Default |
... |
Arguments to pass to either |
3-layer RGB array of the processed image.
if(run_documentation()){
#Write as a png
tmparr = tempfile(fileext=".png")
ray_read_image(dragon) |>
ray_write_image(tmparr)
ray_read_image(tmparr) |>
plot_image()
}
if(run_documentation()){
#Write as a JPEG (passing quality arguments via ...)
tmparr = tempfile(fileext=".jpg")
ray_read_image(dragon) |>
ray_write_image(tmparr, quality = 0.2)
ray_read_image(tmparr) |>
plot_image()
}
if(run_documentation()){
#Write as a tiff
tmparr = tempfile(fileext=".tiff")
ray_read_image(dragon) |>
ray_write_image(tmparr)
ray_read_image(tmparr) |>
plot_image()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.