[R] Regarding R's png device in linux

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Oct 10 11:55:43 CEST 2012

On 10/10/2012 07:23, Anshul Gupta wrote:
> Hi,
> I am a developer from Oracle. I wanted to create a png file out of
> png
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).

> -/Ag
> Anshul Gupta
> Mobile : +91-814773074
> Linkedin : http://in.linkedin.com/pub/anshul-gupta/19/b36/4a7
> Personal Website : http://www.guptaanshul.com

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list