Re: Reading alpha data from CMYK TIFF

"el_supremo01 <[email protected]>" <[email protected]> Mon, 10 Feb 2003 21:58:56 -0000
Newsgroups gmane.comp.video.image-magick.windows
Message-ID <[email protected]>
Hi Peter,

--- In [email protected], pd@w... wrote:
> I'm trying to read the alpha data for a CMYK TIFF image using
> ImageMagick 5.5.4 on Windows 2000.  I'm using the call to GetIndexes
()
> which, as I understand it, is the only way to get the alpha data for
> CMYK.

I haven't used the GetIndexes call but the documentation says:
"Method GetIndexes() returns the indexes associated with the last 
call to SetImagePixels ( ) or GetImagePixels ( )"

which implies you must have called Set or Get ImagePixels before you 
call GetIndexes. 

I tried adding a GetImagePixels() call and the program terminated 
without crashing, but my ghostscript said there was an error in the 
resulting .ps file.

Here's how I changed the code (with an additional declaration at the 
top of the file of PixelPacket *pp;)

                    // Make 1-bit/pixel string from data
                    bitData = 0;
                    for (row = 0; row < image->rows; row++)
                    {
						pp = GetImagePixels
(image,0,row,image->columns,1);
		                if((alpha = GetIndexes(image)) == 
NULL)printf("OOOPS\n\n\n");
                        for (col = 0; col < image->columns; col++)
                        {
                            bitData *= 2;
                            //bitData |= (alpha[col, row] == 0) ? 0 : 
1;
//                            if (alpha[(row*(image->columns))+col])
                           if (alpha[col])
                                bitData |= 1;


I put the getimagepixels and getindexes calls inside the outer for 
loop so that it fetches one row of the image at a time which requires 
changing the way "alpha" is accessed.
As I say, I don't really know what I'm doing but perhaps this'll get 
you a bit further.

Best Wishes
Pete


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/LIgTpC/vN2EAA/xGHJAA/nhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/