MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: reading pixels from a bmp file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20737] Re: [mg20625] reading pixels from a bmp file
  • From: Andrew Watson <abwatson at mail.arc.nasa.gov>
  • Date: Wed, 10 Nov 1999 00:17:49 -0500
  • References: <199911040713.CAA02692@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

At 2:13 AM -0500 11/4/99, Jesper Bannebjerg wrote:
>Hello
>
>I have a problem with getting Mathematica to read a bitmap pixel by
>pixel.
>I want to load an image from a bmp file and then read each line and
>each pixel.
>How do i do that.
>I can easely get Mathematica to show the graphic image but i cant get
>it to read the elements (the pixels)
>Any ideas ????

Try:

ReadImage[filename_, format_] := Import[filename, format][[1, 1]]

If your file is "file.bmp", then

image = ReadImage["file.bmp", "BMP"] ;

The result will be an array of numbers.

Regards,
Andrew Watson



  • Prev by Date: Re: ContourPlot3D
  • Next by Date: Re: Re: hexagon tiled torus
  • Previous by thread: reading pixels from a bmp file
  • Next by thread: RasterArray doesn't work