Questions on Reading Images

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
fligex
Posts: 1
Joined: 2013-01-22T18:39:58-07:00
Authentication code: 6789

Questions on Reading Images

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Questions on Reading Images

Post by fmw42 »

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Questions on Reading Images

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply