Re: Rendering image to array
- To: mathgroup at smc.vnet.net
- Subject: [mg8264] Re: [mg8098] Rendering image to array
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Sat, 23 Aug 1997 01:59:02 -0400
- Organization: University of Western Australia
- Sender: owner-wri-mathgroup at wolfram.com
seanross at worldnet.att.net wrote:
> David Rosky wrote:
>
> > Is there a way within Mathematica of taking an image
> > generated by a Mathematica graphics command and
> > rendering it as a bitmap into an array of the form
> >
> > {{{R,G,B},{R,G,B}, ...},{{R,G,B},{R,G,B}, ...}, ... }
> >
> > so I can do further processing on the bitmap?
> >
> > I have noticed that the front end has a menu
> > command cell->convert to->Bitmap which converts
> > the cell to a bitmap in the front end but I didn't
> > see any way of getting the bitmap into an array like
> > the one above.
After you have the graphic as a Bitmap, use Convert to InputForm. This
will give you a RasterArray of RGBColor primitives. You can then use
pattern-matching, e.g.,
RGBColor[r_,g_,b_]->{r,g,b}
to obtain the format you want.
Cheers,
Paul
____________________________________________________________________
Paul Abbott Phone: +61-8-9380-2734
Department of Physics Fax: +61-8-9380-1014
The University of Western Australia
Nedlands WA 6907 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://www.pd.uwa.edu.au/Paul
God IS a weakly left-handed dice player
____________________________________________________________________