Read an image from a PNG file and convert the pixel data into an R array.
1 2 3 4
A character string giving the file name to read from.
An object of class
Additional arguments (which are ignored).
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.
readPng returns an integer-mode array of class
inspectPng to read only metadata from the file. In addition,
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
1 2 3 4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.