Read an image from a PNG file and convert the pixel data into an R array.
Usage
readPng(file)
# S3 method for loder
print(x, ...)
Value
readPng returns an integer-mode array of class
"loder". The print method is called for its side-effect.
Arguments
file
A character string giving the file name to read from.
x
An object of class "loder".
...
Additional arguments (which are ignored).
Details
The LodePNG library is used to read the PNG file at the specified path.
LodePNG can handle a wide variety of subformats and bit depths, but the
output of this function is currently standardised to an integer-mode array
with 8-bit range, i.e. between 0 and 255. Attributes specifying the
background colour, spatial resolution and/or aspect ratio are attached to
the result if this information is stored with the image.
See Also
inspectPng to read only metadata from the file. In addition,
the readPNG function in the venerable png package offers
similar functionality to readPng, but relies on an external
installation of libpng. By contrast, loder includes the LodePNG
library.