[R] BMP to matrix

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Jun 28 20:50:36 CEST 2000

On Wed, 28 Jun 2000, Manuel Castejon Limas wrote:

> Hi all, 
> is there any R function that loads a bmp file, or any other format, and converts its grid of pixels into a matrix or data frame?

Almost certainly not (they are binary files) but netpbm and ImageMagick and
such programs have means to convert the files to an ASCII gird of numbers,
which R can read easily.

That's mainly how we do it. For really big image files, I wrote a C
interface that reads the file and fills a pre-allocated array.

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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list