Hi Winfried,

The color manager can help to make things easier.

Please take a look on this algorithm:

- Open the jpeg2000 file

- Is that a 16 bit rgb image?
      yes: input format = TYPE_RGB_16
- Is that a 16 bit gray image?
     yes: input format = TYPE_GRAY_16
- Is that  a 8 bits RGB image ?
    yes: input format = TYPE_RGB_8
... and so one ...

- Is there any embedded profile? yes: use it as input no: use some predefined default profile, on depending on the input space

output format = TYPE_BGR_8
- Do you have profile for your monitor?
 yes: use it as output
 no: use sRGB built-in

- Transform the image from input profile, input format to output profile, output format
by calling cmsCreateTransform(), cmsDoTransform()

- Do a cleanup

That's all. And with such simple algorithm you have true color management, and automatic support of 8 and 16 bits for grayscale and RGB. You can also add support for CMYK
or any other space just adding more input cases.

Regards
Marti.


szukw...@arcor.de wrote:
Marti wrote:
You are assuming that to do a color transform, both input and output
profiles have to be of same colorspace, but that's not true.

For the file:
file7.jp2: color-space(RGB ) profile-connection-space(XYZ )
          16-bit e-sRGB JP2 restricted (to sRGB) profile)

I coded:

   inprof = cmsOpenProfileFromMem(jp2_profile_buf, jp2_profile_len);
   outprof = cmsCreate_sRGBProfile();
   inspace = cmsGetPCS(inprof);
   outspace = cmsGetColorSpace(outprof);

As the inspace is (XYZ ) and the outspace is (RGB ), I supposed I
I had to write:

   transform = cmsCreateTransform(in_prof, TYPE_XYZ_16,
     out_prof, TYPE_RGB_16, intent, 0);

But I got no transform. I had to change the code to:

   transform = cmsCreateTransform(in_prof, TYPE_RGB_16,
     out_prof, TYPE_RGB_16, intent, 0);

Incidentally, there is indeed a cmsCreate_GrayProfile()
I meant a parameterless one like cmsCreate_sRGBProfile().

Because I do not know how to transform the third file, file8.jp2:
-------------- ICC Profile[414] ---------------
cmmtype(0) version(2.32.0.0) class(scnr)
color-space(GRAY) profile-connection-space(XYZ )
date(23.1.2002) time(9:26:16)
signature(acsp) platform-signature()
profile-flags(0x1) [0]1 [1]0 [2:15]0
device-attr(0) white(0) negative(0) matte(0) transparent(0)
rendering-intent(0)
CIE: x(0.63190) y(1.0) z(0.54061)
[0]signature(desc) size[154]
  Restricted ICC profile describing greyscale version of ROMM-RGB
[1]signature(cprt) size[42]
  Copyright 2001 EKC-RICC Reference
[2]signature(wtpt) size[20]
  XYZ(0.214, 0.214, 0.214)
[3]signature(kTRC) size[14]
  curv size[1]
    curv[0]gamma(1.205)
-----------------------------------------------
There is only one channel. I have no 'outprof'.

The two other images, using lcms-2.0, now look enchanting.

winfried

Und was machen Sie heute abend? Alles Events Ihrer Gegend auf einen Blick im 
Arcor.de-Veranstaltungskalender: http://www.arcor.de/rd/footer.events

------------------------------------------------------------------------------

_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user
------------------------------------------------------------------------


Se certifico que el correo entrante no contiene virus.
Comprobada por AVG - www.avg.es Version: 9.0.819 / Base de datos de virus: 271.1.1/2886 - Fecha de la version: 05/20/10 20:26:00


------------------------------------------------------------------------------

_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to