alpha blending in LAB space
  From: Yaron Tadmor 

  I'm pretty new to color management, and color profiles.
  I'm writing an application which allows to composite several images on a 
single canvas, and each image can have its own color profile. The global canvas 
also has a color profile (which is the color profile the final canvas image 
will be exported in).

  When blending the images I need to blend them in a single profile. The most 
appropriate is the canvas profile.

  Since I'm using openGL to render the layers, there's a problem when this 
profile is a CMYK profile. The problem is that openGL doesn't support CMYKA (or 
CMYK for that matter) so I need to split my rendering to 2 parts (CMY and K), 
which slows down the GUI.

  I was wondering if I could somehow use a PCS (say LAB) to perform my 
blending. This way I can convert all input images to the PCS, load them to 
openGL as RGBA textures. Then I can render using openGL letting it do the alpha 
blending on this PCS, and then get the rendered image and convert to the canvas 
profile?

  Could this work?

  My main concern is that if the canvas profile is a narrow gamut profile, I 
might lose precision, since the PCS image data will need to be converted to 
unsigned chars in order to give to openGL.

  Am I making sense, or am I missing something?

You're making sense.  Blending in Lab or XYZ space might give a reasonable 
preview but the appearance will differ significantly from a 4 channel CMYK 
alpha blend.  

RGB, being a close cousin of CMYK, would probably be a better space for an 
approximate blend than either Lab or XYZ.  For example, CMYK(100,0,0,0) and 
CMYK(0, 100, 0, 0) with a 50% alpha will blend to CMYK(50, 50, 0, 0).  In Lab 
space (using Photoshop with the v2 SWOP coated profile for the numbers) the 
corresponsing colors in would be Lab(62, -44, -50) and Lab(52, 81, -7).  
Blending these in Lab space gives Lab(57, 59, -28), or CMYK(21,77,0,0), a 
significantly brighter and warmer color.  A similar problem will happen in XYZ 
space.

I also doubt that doing the extra conversion into and out of the PCS will be at 
all efficient.  Although RGB might work, there may be a similar efficiency 
issue, depending on how accurately you want the conversion to be.  One solution 
that would be fast and accurate would be to write your own CMYK alpha blending 
code to handle four channels + alpha directly.  This is not a difficult piece 
of code to write, and a simple loop that does an alpha weighted average of the 
four channels will be faster than any set of color conversions.

Mike Russell
www.curvemeister.com/forum/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to