Hi Marti and all,

 

We have a case where we have a grayscale image expressed as 4 values per
pixel, the first three are channels, identical to one another,
representing the grayscale value, while the fourth is Alpha.  You could
describe this as GGGA.  The image has a grayscale profile.

 

We would like to transform and copy that image into an RGBA color image
with a color profile.  The output RGBA buffer uses the predefined types
TYPE_RGBA_8, TYPE_RGBA_16, or TYPE_RGBA_FLT.

 

Before LCMS 2.8, we expressed the input grayscale image as follows:

 

#define TYPE_GxxA_8
(COLORSPACE_SH(PT_GRAY)|EXTRA_SH(3)|CHANNELS_SH(1)|BYTES_SH(1))

#define TYPE_GxxA_16
(COLORSPACE_SH(PT_GRAY)|EXTRA_SH(3)|CHANNELS_SH(1)|BYTES_SH(2))

#define TYPE_GxxA_FLT
(FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|EXTRA_SH(3)|CHANNELS_SH(1)|BYTES_SH(
4))

 

This all worked fine except of course the A value was not copied.  We
had a routine that would copy the A values separately.

 

Now we'd like to use the new 2.8 preserve extra channel feature, but the
LCMS 2.8 won't copy the A value because the number of extra channels
from the grayscale input (3) doesn't match the number for the color
output (1).

 

Our first obvious idea was to define and use these for the grayscale
image:

 

#define TYPE_GGGA_8
(COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(1))

#define TYPE_GGGA_16
(COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))

#define TYPE_GGGA_FLT
(FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(
4))

 

This seems to work fine with LCMS 2.8, and now copies the A across since
there's just the one extra A channel in both input and output formats.

 

However, my questions are these, since grayscale images don't normally
have 3 channels of data...

 

Is this valid?

Since it's a grayscale image does LCMS use all three values or just the
first one?

Do we pay a performance penalty for asking LCMS to transform 3 channels
that are all exactly the same?  

 

Thanks in advance for sharing your wisdom.

 

-Noel

 

 

 

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to