Page 1 of 1

Questions on Reading Images

Posted: 2013-01-22T18:46:19-07:00
by fligex
Hello everyone,

I do not know what I'm doing, but I think I know what I want to do. I was told, from (i believe) a reliable source, that somehow I could use ImageMagick or something similar to "read" an image file and essentially end up with an array of information for each pixel available. So say a 1024x768 image would result in a 1024x768 array in which each element of that array contained data relative to the pixel in its corresponding location. How could I go about achieving this? Obviously a step by step would be ideal but I'll take any help one is willing to offer.

Re: Questions on Reading Images

Posted: 2013-01-22T20:37:42-07:00
by fmw42

Re: Questions on Reading Images

Posted: 2013-01-28T16:30:57-07:00
by anthony
For acutal arrays look at NetPbmPlus
IM Examples, Formats, Other Formats

http://www.imagemagick.org/Usage/formats/#pbmplus

The ascii (non-binary) modes return just the numbers (triplets for RGB, single numbers for grayscale) when makes it ideal for generating arrays of values.

However the "txt" format is also useful when you just what a indexed list of values, or want to filter out or only read locations of specific colored pixels, (cor example using the "grep" UNIX text utility).

There are examples of feeding this to awk (another text utility) to do calculations on the data on the fly, for example rotate images (distort) based only on whole pixels.
http://www.imagemagick.org/Usage/distor ... rd_mapping