writePng: Write a PNG file

writePngR Documentation

Write a PNG file

Description

Write a numeric or logical array to a PNG file.

Usage

writePng(image, file, ..., compression = 4L, interlace = FALSE)

Arguments

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 image. See Details.

compression

Compression level, an integer value between 0 (no compression, fastest) and 6 (maximum compression, slowest).

interlace

Logical value: should the image be interlaced?

Details

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.

Value

The file argument, invisibly.

See Also

readPng for reading images.


loder documentation built on Dec. 28, 2022, 2:22 a.m.