Re: 2 questions about bitmap images
- To: mathgroup at smc.vnet.net
- Subject: [mg28763] Re: 2 questions about bitmap images
- From: "Mariusz Jankowski" <mjkcc at usm.maine.edu>
- Date: Fri, 11 May 2001 20:00:41 -0400 (EDT)
- Organization: University of Southern Maine
- References: <9d85io$84p@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Barthelet, 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 ====================================================== Mariusz Jankowski University of Southern Maine mjkcc at usm.maine.edu "Barthelet, Luc" <lucb at ea.com> wrote in message news:9d85io$84p at smc.vnet.net... > 1) I would like to use Raster to display a bitmap in a graphic, but I would > like some of the values of the bitmap to not be displayed (100% transparent > 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 of > 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 be > 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!" > >