[R] png() does not generate a 24 bit PNG file

From: Fán Lóng <foylong_at_gmail.com>
Date: Wed, 30 Jul 2008 18:37:37 +0800


Hi there,

When I am using the png() function as the following to generate a png file on Mac OSX Tiger, I found that the bit depth is 32. But I want a 24 bit depth png. What should I do?

> png(filename="/Users/usg/Desktop/new.png")
> plot(1:20)
> dev.off()

To avoid using "cairo", and R-2.7.0 does not find a Xlib on my Mac, I also tried this one:
> png(filename="/Users/usg/Desktop/new.png", type ="quartz" )
> plot(1:20)
> dev.off()

It does not work, either.

The manual says "png will 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)." I don't want to set palette less than 256 colours, I just want a 24-bit png file.

Could anyone help me?

Thanks in advance.
Long



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 30 Jul 2008 - 10:49:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Jul 2008 - 11:32:59 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive