Page 1 of 1

XYZ colorspace pixels

Posted: 2008-10-09T12:37:27-07:00
by drewvy
I'm loading a tiff file that is in XYZ colorspace. Here is the call I use to get a row of pixels:

pixels=GetImagePixels(image1,0,loop,image1->columns,1);

Then I iterate the row with another loop like this:

X = (pixels1+loop2)->red
Y = (pixels1+loop2)->green
Z = (pixels1+loop2)->blue

Here is my question is. Does X, Y, and Z really mapped like I have it above to RED, GREEN, and BLUE?

Re: XYZ colorspace pixels

Posted: 2008-10-09T16:49:26-07:00
by anthony
Yes. That is how the data is arranged. Don't think of the 'R' channel as being red, think of it as 'channel 1' which could be red, hue, X, cyan, or other things depending on the image color space.
'R' is just a label for the channel typically used for 'red'.

I have add the above to IM examples, Basics, and Channels.

http://www.imagemagick.org/Usage/basics/#colorspace


If you read and manipulate such an image within IM, you can also tell ImageMagick that this image is XYZ by using...

Code: Select all

    convert xyz_image.tiff  -set colorspace XYZ ....
the -set colorspace operator does not modify the image data, just re-defines how IM will interprete that data.

If you want to convert it between other color spaces.
EG: convert XYZ image to RGB image

Code: Select all

    convert xyz_image.tiff  -set colorspace XYZ -colorspace RGB image_RGB.tiff
-colorspace does modify the data converting the 'declared' XYZ image data to RGB image data.

Re: XYZ colorspace pixels

Posted: 2008-10-10T08:53:56-07:00
by drewvy
Thanks. You guys rock.