[prev in list] [next in list] [prev in thread] [next in thread]
List: imagemagick-developer
Subject: Re: [magick-developers] Questions about ImageMagick!
From: yarrow () studio ! imagemagick ! org
Date: 2004-08-20 13:45:16
Message-ID: 200408201345.i7KDjGEx003780 () studio ! imagemagick ! org
[Download RAW message or body]
When an image is instantiated it defaults to a PixelPacket per pixel location
of red, green, blue, and opacity. Opacity is considered undefined until you
set image->matte to MagickTrue. The K channel of CMYK or colormapped indexes
are undefined until you set image->colorspace to CMYK or set
image->storage_class to PseudoClass respectively. They remain undefined until
your first call to GetImagePixels() or SetImagePixels(). Once defined you
access the K channel, for example, like this:
<assume image is CMYK>
cmyk_image->colorspace=CMYKColorspace;
for (y=0; y < (long) image->rows; y++)
{
p=AcquireImagePixels(image,0,y,image->columns,1,exception);
q=SetImagePixels(cmyk_image,0,i++,cmyk_image->columns,1);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
break;
indexes=GetIndexes(image);
cmyk_indexes=GetIndexes(cmyk_image);
for (x=0; x < (long) image->columns; x++)
{
q->red=p->red;
q->green=p->green;
q->blue=p->blue;
if (image->matte != MagickFalse)
q->opacity=p->opacity;
if (image->colorspace == CMYKColorspace)
cmyk_indexes[x]=indexes[x];
p++;
q++;
}
Even though you specify p->red, it represents the CYAN component for CMYK
images.
_______________________________________________
Magick-developers mailing list
Magick-developers@imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-developers
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic