Store pixels in sub image wise in 2d array

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
rohitkrishna
Posts: 43
Joined: 2011-10-01T14:34:04-07:00
Authentication code: 8675308

Store pixels in sub image wise in 2d array

Post by rohitkrishna »

Hi Everyone,

Can any one please explain me how can i store the r,g,b values of a image..by sub-image wise in a 2d array using image magick...?

Lets say an image is of 15x15..i have to store the r,g,b values in 2d array by 5x5 sub-images...wise.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Store pixels in sub image wise in 2d array

Post by fmw42 »

I think this needs a bit more clarification. Are you trying to take every 15x15 pixel region from the image and make a new 15x15 pixel image for each region? Is there overlap of the regions in the input image? Do I totally misunderstand what you want?


Take a look at the -crop operator at:
http://www.imagemagick.org/Usage/crop/#crop
and especially at
http://www.imagemagick.org/Usage/crop/#crop_tile
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Store pixels in sub image wise in 2d array

Post by anthony »

OR are you just wanting to read the data.. If so what language? What data format?

You are not detailed enough for us to help.

PS: one simple universal way is to just get Im to output a TXT: file (enumerated pixel format)
See http://www.imagemagick.org/Usage/files/#txt

Also see the section.. Extracting Image Colors.
http://www.imagemagick.org/Usage/quantize/#extract

These are however specific to command line, for other API's other techniques are available.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply