write_tif | R Documentation |
Write images into a TIFF file.
write_tif(
img,
path,
bits_per_sample = "auto",
compression = "none",
overwrite = FALSE,
msg = TRUE,
xresolution = NULL,
yresolution = NULL,
resolutionunit = NULL,
orientation = NULL,
xposition = NULL,
yposition = NULL,
copyright = NULL,
artist = NULL,
documentname = NULL,
datetime = NULL
)
tif_write(
img,
path,
bits_per_sample = "auto",
compression = "none",
overwrite = FALSE,
msg = TRUE,
xresolution = NULL,
yresolution = NULL,
resolutionunit = NULL,
orientation = NULL,
xposition = NULL,
yposition = NULL,
copyright = NULL,
artist = NULL,
documentname = NULL,
datetime = NULL
)
img |
An array representing the image.
|
path |
Path to the TIFF file to write to. |
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? |
xresolution |
Numeric value specifying the horizontal resolution in
pixels per unit. This is typically used with |
yresolution |
Numeric value specifying the vertical resolution in pixels
per unit. This is typically used with |
resolutionunit |
Integer specifying the unit of measurement for
|
orientation |
Integer specifying the orientation of the image. Valid values are:
|
xposition |
Numeric value specifying the x position of the image in
resolution units. This is typically used with |
yposition |
Numeric value specifying the y position of the image in
resolution units. This is typically used with |
copyright |
Character string specifying the copyright notice for the image. |
artist |
Character string specifying the name of the person who created the image. |
documentname |
Character string specifying the name of the document from which the image was scanned. |
datetime |
Date/time for the image. Can be provided as a character string in format "YYYY:MM:DD HH:MM:SS", a Date object, a POSIXct/POSIXlt object, or any object that can be converted to a datetime using lubridate::as_datetime(). If NULL (default), no datetime is set. |
The input img
(invisibly).
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.
read_tif()
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$")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.