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?
XYZ colorspace pixels
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: XYZ colorspace pixels
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...
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
-colorspace does modify the data converting the 'declared' XYZ image data to RGB image data.
'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 ....
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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/