Re: Re: Reading alpha data from CMYK TIFF
[email protected] Mon, 10 Feb 2003 17:23:18 -0500
| Newsgroups | gmane.comp.video.image-magick.windows |
|---|---|
| Message-ID | <[email protected]> |
Aha! I know that GetIndexes() is really an overloaded function. For images with a CLUT, it returns the pixel values as lookup table indices (hence the name), and for CMYK images with alpha channels, it returns the alpha data. I had thought that the reference to GetImagePixels/SetImagePixels was only for the first use, but apparently I need to do that in the second case also. Thanks *very* much for catching this. There also seems to be a bug somewhere in my code for generating the PostScript, but I can easily fix that. Thanks again! -pd On Mon, Feb 10, 2003 at 09:58:56PM -0000, el_supremo01 <[email protected]> wrote: > 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 > > > > 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/ > > -- ------------------------ 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/