Re: Rendering image to array
- To: mathgroup at smc.vnet.net
- Subject: [mg8206] Re: [mg8098] Rendering image to array
- From: seanross at worldnet.att.net
- Date: Mon, 18 Aug 1997 23:24:55 -0400
- Sender: owner-wri-mathgroup at wolfram.com
David Rosky wrote:
>
> Hi,
>
> 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.
>
> Thanks for any help,
>
> --Dave
> dave.rosky at badc.ssi1.com
You cannot do this with mathematica alone, however, with the addition of
PaintShop Pro, a shareware program available at www.jasc.com, you can.
You save the image as a bitmap, load it into PSP, save it as: RAW or
PPM(portable pixel map) format, then ReadList it back into mathematica.
I have done almost what you describe, but read the bitmap in from a file
and converted it into a RasterArray and just displayed it on the
screen. You will need to experiment with the various options to
ReadList to get it to work correctly. As I remember, I read the whole
thing in as an array of strings, then inserted commas and converted the
strings to integers, but I don't have my notebook here with me and my
memory is a little fuzzy. It is possible, though, you just may have to
play with it a little. Good Luck.