Page 1 of 1

get gray values with magick++

Posted: 2006-04-10T13:48:31-07:00
by mrjvak
I have read a gray pgm-file into the Image object. Can anyone please supply me with an example of how to put the gray values into a vector<int> for example!

is it going to be someting like this:
vector<int> vec;
for( x=0; x<width; x++)
for( y=0; y<height; y++)
vec.push_back( image.get(x,y) )

put get returns a PixelPacket, and how do I get the gray value from that?

many thanks

Posted: 2006-04-10T14:11:19-07:00
by magick
If the image is already gray, just grab the redQuantum() of your pixel for the gray intensity.

Posted: 2006-04-10T14:47:17-07:00
by mrjvak
ok many thanks,
but please don't take for granted I know the concepts here, I am trying to learn. I suppose I should use readPixels() in order to use QuantumTypes. BUt where are they documented maybe they are not part of magick++ ?