Just do m <- as.matrix(store)
or m <- as.image.SpatialGridDataFrame(store)$z image(m) They give the same result with different orientations. Note that both assume a single-band raster, e.g. you only have a "greyscale" bitmap (for example). The details behind all this is given in the documentation for the sp package. See ?image for the basic image plot for a matrix. Cheers, Mike. On Thu, Nov 24, 2011 at 11:50 PM, Alaios <ala...@yahoo.com> wrote: > Dear all, > I have asked yesterday of how I can read a simple bitmap file in R cran. > > I was suggest to use either readGDAL or raster for loading my bitmap > > > a. I have done it with readGDAL like > > store<-readGDAL(fname='lena256.bmp') > and it works,... but it converts my matrix-like notion of a bitmap to a > large vector > > b. Raster also returns a class that I can not understand. > > So 1, I want to load it and keep the image as a matrix (so every cell in the > matrix will correspond to a pixel) > 2. I want to be able to plot the image based on that matrix that I have > loaded too. > > Could you please explain me how I can do those? > > B.R > Alex > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@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. > > -- Michael Sumner Institute for Marine and Antarctic Studies, University of Tasmania Hobart, Australia e-mail: mdsum...@gmail.com ______________________________________________ R-help@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.