[R] Windows BMPs: Why grey background? How to display BMP in R?

Earl F. Glynn efg at stowers-institute.org
Tue Feb 8 21:40:51 CET 2005


"Duncan Murdoch" <murdoch at stats.uwo.ca> wrote in message
news:3j4i015lan8u9cu1eueuk8h5ghru2gt8hd at 4ax.com...
> On Tue, 8 Feb 2005 11:35:22 -0600, "Earl F. Glynn"
> <efg at stowers-institute.org> wrote :

> In what version of R?  I just tried in 2.01 and R-patched, and it was
> fine.  Maybe the problem is your viewer?

Sorry.

I thought I was using R 2.0.1 but I used a shortcut on my desktop that
started the older R 2.0.0 -- so I just rediscovered the problem that you've
already fixed.  With the correct shortcut to R 2.0.1, I am seeing a white
bmp background.  Sorry to have bothered you with this.

I don't see much information about the bmp driver (from ?bmp).  I noticed
the BMPs that are created have only 8-bit color depth, which means the
palette must be stored with the image.  But what is the palette R uses with
BMPs?  I always use true color (24-bit) bmps in Windows instead of 8-bit
bmps to avoid palette issues on older 256 color displays.

Microsoft recommended only using 240 of the 256 palette entries, since 16
were reserved for system colors for older 256 color display monitors (which
are no longer common) and the Windows palette manager.  I guess R's bmps
only have 240 colors that will work on all PCs.

So are bmps created under R restricted to a single, fixed 256 color palette?
(I don't see any color palette parameter to the bmp device.) Is there any
way to create an R bmp that is hicolor (15 or 16-bit color) or true color
(24-bit color) to avoid the palette issues of 8-bit bmps?

Thanks for any info about this.

efg




More information about the R-help mailing list