Skip to content

Regarding R's png device in linux

2 messages · Anshul Gupta, Brian Ripley

#
On 10/10/2012 07:23, Anshul Gupta wrote:
device with a bit depth of 8. I am using R on linux. But I noticed that
R automatically switches between 8 and 24 bit depth. i tried a lot of
things from your grDevices package but unable to control the bitdepth. I
would be really grateful to you guys if you can suggest me some way to
solve this issue.

Let me read the help page to you ...

      ?png? will normally use a palette if there are less than 256
      colours on the page, and record a 24-bit RGB file otherwise (or a
      32-bit RGBA file if ?type = "cairo"? and non-opaque colours are
      used).  ...

So, it is obvious that you need to use less than 256 colours (which is 
all PNG8 can support: it is not a 'bit depth' as it uses a palette).