write_tif {ijtiff} | R Documentation |
Write images in TIFF format
Description
Write images into a TIFF file.
Usage
write_tif(
img,
path,
bits_per_sample = "auto",
compression = "none",
overwrite = FALSE,
msg = TRUE
)
tif_write(
img,
path,
bits_per_sample = "auto",
compression = "none",
overwrite = FALSE,
msg = TRUE
)
Arguments
img |
An array representing the image.
|
path |
file name or a raw vector |
bits_per_sample |
number of bits per sample (numeric scalar). Supported
values are 8, 16, and 32. The default |
compression |
A string, the desired compression algorithm. Must be one
of |
overwrite |
If writing the image would overwrite a file, do you want to proceed? |
msg |
Print an informative message about the image being written? |
Value
The input img
(invisibly).
Author(s)
Simon Urbanek wrote most of this code for the 'tiff' package. Rory Nolan lifted it from there and changed it around a bit for this 'ijtiff' package. Credit should be directed towards Lord Urbanek.
See Also
Examples
img <- read_tif(system.file("img", "Rlogo.tif", package = "ijtiff"))
temp_dir <- tempdir()
write_tif(img, paste0(temp_dir, "/", "Rlogo"))
img <- matrix(1:4, nrow = 2)
write_tif(img, paste0(temp_dir, "/", "tiny2x2"))
list.files(temp_dir, pattern = "tif$")