[R] How to read .bmp files into R? read.pnm throws error

Duncan Murdoch dmurdoch at pair.com
Sat Nov 22 01:37:25 CET 2003

On Fri, 21 Nov 2003 15:57:35 -0800, you wrote:

>Is there a way to read .bmp files into R? I have tried read.pnm from pixmap
>package. It returned
>Error in pm.readmagicnumber(con) : Not a PNM format file
>Anyother ways to load bitmap images?

.bmp format is fairly simple, and is well documented (e.g. see
www.wotsit.org).  It wouldn't be hard to write a reader using

The only difficulty is that several pixel formats are available.
However, if you have control of the creation of the files, you can
choose 24 bit BMPs, which are the simplest to read.

Duncan Murdoch

More information about the R-help mailing list