Re: [Lcms-user] Trying to get Photoshop Spot Color CMYK equiv. from TIFF
An ICC-based CMM for color management
Brought to you by:
mm2
From: Marti.Maria <mar...@li...> - 2009-08-28 10:07:31
|
Hi Jim Good progress. You go in the right direction, but there are some wrong assumptions. First and most importantly, Lab TIFF files don't have embedded ICC profiles. Why? Easy, just because Lab is a device independent color space and therefore there is enough information to convert from Lab to any other device. So, you are not going to find profiles over here. Or maybe just Lab to Lab identities. Then the second part. You talk about PANTONE. Then which pantone? as you already know, there are many different PANTONE families, coated, pastel, metallic. So you need to know which is the DESTINATION of your Lab color. And here you need an ICC profile. A good choice could be the SWOP or FOGRA profiles. They come with Photoshop and doing some search in the net you can find them very easely. Search for USWebcoatedSWOP.icc Now comes the magic. Do a color transform from Lab to the SWOP profile, and you have a way to convert from Lab to PANTONE CMYK. Use relative colorimetric or absolute colorimetric to obtain good matches. The code is identical to the Sample2 in the tutorial, but using CMYK instead of RGB. There is an additional caveat on the Lab encoding, as TIFF encoded Lab in a different way than ICC, so you need to convert between notations. You may use this code to convert from a 8 bit Lab pixel stored in accum to a 16 bit wIn[3] ICC v2 Lab encoding. Another solution would be to use TYPE_Lab_DBL and floating point. Floating point is the best option if you need to convert few values, encoded 16 bits is better if you need to convert 10 megabytes or more. static TIFFLab8(uint16_t wIn[], unsigned char* accum) { wIn[0] = (accum[0]) << 8; wIn[1] = ((accum[1] > 127) ? (accum[1] - 128) : (accum[1] + 128)) << 8; wIn[2] = ((accum[2] > 127) ? (accum[2] - 128) : (accum[2] + 128)) << 8; } Regards Marti. Jim Carroll wrote: > Hi, I'm new to Color profiles and lcms, and wonder if you can help me > understand how to grab spot color information from a TIFF file > correctly. > > In Photoshop, I set the spot color swatch to a particular CMYK value. > When I parse the TIFF, I see it's in the CIELab colorspace. > > So far, I've been able to get the profile out of the TIFF: > > if (TIFFGetField(tiff, TIFFTAG_ICCPROFILE, &EmbedLen, &EmbedBuffer)) > { > printf("we have an ICCPROFILE\n"); > hProfile = cmsOpenProfileFromMem(EmbedBuffer, EmbedLen); > if (hProfile == 0) > { > hProfile = OpenStockProfile(cDefInpProf); > printf("but we couldn't read it.\n"); > } > } > > And I've also been able to get the Lab color out of the Photoshop > binary block within the TIFF. I'm grabbing the irb_word 0x3EF and > seeing: > > cs: 7 Lab: 0x0763 0x1315 0xDFB9 0x0000 alpha: 0064 > > I can see from the lcms tiff example that I have to unpack the Lab values... > > But what I'm not seeing is a call in lcms to transform this Lab to > CMYK. I need the CMYK because I'm converting the TIFF with spot > colors to PDF. > > Do I need to create a second default color profile, and then a > transform between the two? I want to avoid creating whole LUTs, > because in the worst case I'll only have a few Lab colors to convert. > > Thanks! > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Lcms-user mailing list > Lcm...@li... > https://lists.sourceforge.net/lists/listinfo/lcms-user > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.375 / Virus Database: 270.13.71/2330 - Release Date: 08/27/09 18:02:00 > > |