r - What is the result of readPNG function? -


i don't think understand function readpng. in can find piece of code

img <- readpng(system.file("img", "rlogo.png", package="png")) 

img numieric vector num[1:76 1:100 1:4] (but dispalyed in form of 4 matrices)

when read png file (25 x 25, logical [only black or white pixels]) vector num[1:25 1:25 1:3]. seems these 3 logical matrices same. please explain me result of readpng function? why once dispalyed 4 matrices, once three?

while i'll concede many of r manual pages obtuse, 1 pretty good.

value  if native false array of dimensions height x width x channels. if there 1 channel result matrix. values reals between 0 , 1. if native true object of class nativeraster returned instead. latter cannot computed on efficient way draw using rasterimage.  common files decompress rgb (3 channels), rgba (4 channels), grayscale (1 channel) or ga (2 channels). note g , ga images cannot directly used in rasterimage unless native set true because rasterimage requires rgb or rgba format (nativeraster 8-bit rgba).  of png 0.1-2 files 16-bit channels converted in full resolution array format, nativeraster format supports 8-bit , therefore truncation performed (eight least significant bits dropped) warning if native true. 

Comments