Re: 1. Input of screen coordinates; 2. Fast graphics
- To: mathgroup at smc.vnet.net
- Subject: [mg26972] Re: 1. Input of screen coordinates; 2. Fast graphics
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 30 Jan 2001 03:38:22 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <94vs7q$oa9@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I can't answer your first question, Look into the Raster[] outpur if you read a palette image (GIF's) The color function is a huge switch statment with the palette. in you case it may help but yourPalette={3,5,67,255,196,...}; Show[ Graphics[ Raster[your600x600Array,ColorFunction->(Hue[yourPalette[[#]]/MaxColor] &)] ] ] Hope that helps Jens > 2nd question - Suppose you have an array 600x600 of numbers (of colors) in > Mathematica and you want to get an image of a square (600x600 pixels), > each pixel having a color depending on the number in the corresponding > position of the array. (If Color is the array and MaxColor the maximum > element of the array, the color of pixel {x,y} could be given by > Graphics[Hue[Color[[x,y]]/MaxColor]]). > Of course it is very easy to do that by appending instructions > Graphics[Hue[color[[x,y]]/MaxColor]], Graphics[Point[[x,y]]], ... and for > economy, if the color did not change, you may even suppress the color > instruction. This works for small arrays, but it takes a lot of computing > time if the array is big, e.g. 600x600. > Is there a fast way of getting the picture? > If not, I would consider saving the corresponding array to a > file and using another program to view the image. Any suggestion? > > Thanks in advance. > > Manuel Chaves