MathGroup Archive 2001

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

Search the Archive

Re: 2 questions about bitmap images

  • To: mathgroup at
  • Subject: [mg28763] Re: 2 questions about bitmap images
  • From: "Mariusz Jankowski" <mjkcc at>
  • Date: Fri, 11 May 2001 20:00:41 -0400 (EDT)
  • Organization: University of Southern Maine
  • References: <9d85io$>
  • Sender: owner-wri-mathgroup at


this is an addition to the response posted by Jens-Peer Kuska. As he pointed
out, you can do

gr = Plot[Sin[x], {x,0,6}];

tmp = ImportString[ExportString[gr, "BMP"], "BMP"] (* use ImageSize to
control the dimensions of the resulting Raster *)

and you will get a Graphics[Raster[ ] ] object.

Now, with the "Digital Image Processing" application you simply use

img = ToGrayLevel[ tmp[[1, 1]] ] (* for monochrome Rasters *)

which is the typical method for converting a matrix of values (i.e. raw
data) into an ImageData object representing a monochrome image.


Mariusz Jankowski
University of Southern Maine
mjkcc at

"Barthelet, Luc" <lucb at> wrote in message
news:9d85io$84p at
> 1) I would like to use Raster to display a bitmap in a graphic, but I
> like some of the values of the bitmap to not be displayed (100%
> pixels).
> I have been able to achieve this by writing my own version of Raster that
> draw each pixel as a rectangle, but I would like to know if there is a way
> to get the regular Raster to do it. I hate to carry around my own version
> Mathematica functions.
> 2) I am starting to use the "Digital Image Processing" application add-on.
> Has anyone figured out how to take a graphic generated by a previous Show
> command and turn it into an "ImageData" structure? It seems there should
> a way to do it using the usual Display or maybe even Export?
> I'd rather not have to write a file and then read it back.
> Thanks,
> Luc
> "Things well understood are explained well!"

  • Prev by Date: RE: units
  • Next by Date: Re: Interior of a polygon
  • Previous by thread: Re: 2 questions about bitmap images
  • Next by thread: Urgent Message Link --- Sample J/Link Projects