writePng | R Documentation |
Write a numeric or logical array to a PNG file.
writePng(image, file, ..., compression = 4L, interlace = FALSE)
image |
An array containing the pixel data. |
file |
A character string giving the file name to write to. |
... |
Additional metadata elements, which override equivalently named
attributes of |
compression |
Compression level, an integer value between 0 (no compression, fastest) and 6 (maximum compression, slowest). |
interlace |
Logical value: should the image be interlaced? |
The LodePNG library is used to write a PNG file at the specified path. The source data should be of logical, integer or numeric mode. Metadata attributes of the image will be stored where applicable, and may be overwritten using named arguments. LodePNG will choose the bit depth of the final image.
Attributes which are currently stored are as follows. In each case an argument of the appropriate name can be used to override a value stored with the image.
range
A numeric 2-vector giving the extremes of the intensity window, i.e. the black and white points. Values outside this range will be clipped.
background
A hexadecimal colour string giving the background colour.
dpi
A numeric 2-vector giving the dots-per-inch resolution of the image in each dimension.
asp
The aspect ratio of the image. Ignored if dpi
is
present and valid.
text
A character vector (possibly named) of text strings to store in the file. Only ASCII and UTF-8 encoded strings are currently supported.
Dimensions are always taken from the image, and cannot be modified here.
The file
argument, invisibly.
readPng
for reading images.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.