Thread: [Lcms-user] lcms vs. libjpeg for CIELAB ITU-Fax T.43/T.42
An ICC-based CMM for color management
Brought to you by:
mm2
From: Lee H. <fa...@ho...> - 2007-10-23 20:05:07
|
Hello. I'm researching the best method to extend color fax support in HylaFAX. Currently HylaFAX can, with the right configuration, receive a color fax which gets stored wrapped in a TIFF file using libtiff. HylaFAX cannot currently send color fax. Due to the problem that most TIFF viewers are incapable of dealing with CIELAB ITU-Fax colorspace I either need to change the colorspace to something more common before the file is written, or I need to teach libtiff tools such as tiffcp and tiff2pdf to properly handle the unique colorspace. Normally, I would think that the best approach on that would be to work on developing libtiff. However, libtiff uses libjpeg for its JPEG support, and libjpeg development is all but dead after Tom Lane's departure from it. I am unsure as to whether or not libtiff can properly support CIELAB ITU-Fax colorspace without modifications being made to libjpeg. Because if not, it will be nearly impossible to get any development in libjpeg upstream and to quickly see that work in a new release and picked up and used by most of the various libjpeg users. (Ripping-out and modifying libjpeg on a running system without impacting many, many other system components that depend on libjpeg is extremely difficult.) And if that is the case (if libtiff cannot do it without modifications to libjpeg) then it may be best for me to persue the CIELAB ITU-Fax colorspace transitions independent from both libtiff and libjpeg. I would also like to develop support for sending color faxes also. Since the users are going to supply common JPEG image files for fax sending it may simply be easiest for me to take the JPEG and then transform it into CIELAB ITU-Fax coloring and send it from that. However, I do need to put a "tagline" at the top of each fax page indicating, for example, things like date and time and page number... and I'd like this to be as lossless as possible. Can anyone discuss with me the merits of considering lcms for this project instead of libtiff/libjpeg development? As I'm fairly novice with JPEG and I know very little about libjpeg or lcms internals I would appreciate any help that you could provide. Thanks, Lee. |
From: Kai-Uwe B. <ku...@gm...> - 2007-10-23 21:18:59
|
Hello Lee, I've got a opposite question. Can you provide a ITU tiff file example and probably a sRGB conterpart to cross check? Libjpeg should be handle each 3 channel colour space equally. Provided you attach a colour description, best a ICC profile. kind regards Kai-Uwe Behrmann -- developing for colour management www.behrmann.name + www.oyranos.org + www.cinepaint.org |
From: Hal V. E. <hv...@as...> - 2007-10-23 21:48:44
|
On Tuesday 23 October 2007 14:17:01 Kai-Uwe Behrmann wrote: > Hello Lee, > > I've got a opposite question. Can you provide a ITU tiff file example and > probably a sRGB conterpart to cross check? > > Libjpeg should be handle each 3 channel colour space equally. Provided you > attach a colour description, best a ICC profile. > > kind regards > Kai-Uwe Behrmann > -- > developing for colour management > www.behrmann.name + www.oyranos.org + www.cinepaint.org I find several references on the web to a CIELab ITU/Fax profile named iitufax.icm but I was not able to find a copy of it. But if it is available or if there are enough specifications to create one then using lcms to convert between the normal colorspaces that we see used for most jpeg images and CIELAB ITU-Fax T.43/T.42 in either direction should be almost trivial to implement. Hal |
From: Bob F. <bfr...@si...> - 2007-10-23 21:59:17
|
On Tue, 23 Oct 2007, Hal V. Engel wrote: > > I find several references on the web to a CIELab ITU/Fax profile named > iitufax.icm but I was not able to find a copy of it. But if it is available > or if there are enough specifications to create one then using lcms to > convert between the normal colorspaces that we see used for most jpeg images > and CIELAB ITU-Fax T.43/T.42 in either direction should be almost trivial to > implement. Is it possibly this file from the lcms profiles collection? LCMSLABI.ICM little cms Relative L*a*b* identity profile WhitePoint : D50 XYZ=(1.0, 1.0, 0.8) Lab=(100.000, 0.016, -0.016) (x,y)=(0.346, 0.359) Hue=314.75, Chroma=0.02 or is FAX different? There is also: Tifflab8spac.icm TiffLab8Spac D65 (c) Linotype-Hell WhitePoint : D65 (daylight) XYZ=(1.0, 1.0, 1.1) Lab=(100.000, -2.379, -19.401) (x,y)=(0.313, 0.329) Hue=263.01, Chroma=19.55 Bob ====================================== Bob Friesenhahn bfr...@si..., http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ |
From: Lee H. <fa...@ho...> - 2007-10-23 22:41:25
|
Kai-Uwe Behrmann wrote: >I've got a opposite question. Can you provide a ITU tiff file example and >probably a sRGB conterpart to cross check? > > There are a couple of samples of ITULAB JPEG in TIFF here: http://bugzilla.remotesensing.org/show_bug.cgi?id=736 The dialogue there may interest you as well. It represents the extent of my effort thus far in accomplishing this task (which I've been dabbling at for years now, but never really undertaken seriously). >Libjpeg should be handle each 3 channel colour space equally. Provided you >attach a colour description, best a ICC profile. > Attach the ICC profile into the TIFF? Could you elaborate, please? Thanks, Lee. |
From: Lee H. <fa...@ho...> - 2007-10-23 22:44:36
|
Hal V. Engel wrote: >I find several references on the web to a CIELab ITU/Fax profile named >iitufax.icm but I was not able to find a copy of it. But if it is available >or if there are enough specifications to create one then using lcms to >convert between the normal colorspaces that we see used for most jpeg images >and CIELAB ITU-Fax T.43/T.42 in either direction should be almost trivial to >implement. > The itufax.icm file can be generated by compling and running lcms-1.17/samples/itufax.c in the little cms distribution. [root@gollum lcms-1.17]# file samples/itufax.icm samples/itufax.icm: Kodak Color Management System, ICC Profile [root@gollum lcms-1.17]# As I've not used lcms before could you clarify on the triviality of implementing the converter? Thanks, Lee. |
From: Hal V. E. <hv...@as...> - 2007-10-23 23:19:15
|
On Tuesday 23 October 2007 15:44:34 Lee Howard wrote: > Hal V. Engel wrote: > >I find several references on the web to a CIELab ITU/Fax profile named > >iitufax.icm but I was not able to find a copy of it. But if it is > > available or if there are enough specifications to create one then using > > lcms to convert between the normal colorspaces that we see used for most > > jpeg images and CIELAB ITU-Fax T.43/T.42 in either direction should be > > almost trivial to implement. > > The itufax.icm file can be generated by compling and running > lcms-1.17/samples/itufax.c in the little cms distribution. > > [root@gollum lcms-1.17]# file samples/itufax.icm > samples/itufax.icm: Kodak Color Management System, ICC Profile > [root@gollum lcms-1.17]# > > As I've not used lcms before could you clarify on the triviality of > implementing the converter? > > Thanks, > > Lee. Here is a chunk of code that does a transform from an input profile (Device profile for a scanner or a camera) to a display color space. In this case the image is either in a format that uses double values for the channels or it is converted before the tranform is applied IE. TYPE_RGB_DBL. JPEG images would normally be TYPE_RGB_8 like the output of this code. You should find LCMS easy to use for this type of thing. This code only implements the transform. You also need to think about looking for an embedded color space in any images that are passed to your fax software so that you can use the correct color space when transforming to the FAX color space. void ImageItem::TransformImage(const QString OutputProfile, const QString InputProfile, vigra::DRGBImage& p, QImage& pout) { struct dblColor { double r, g, b; }; struct uint8Color { char r, g, b; }; dblColor *RGB; uint8Color *rgb; double divisor; RGB = (dblColor*) malloc(sizeof(dblColor)); rgb = (uint8Color*) malloc(sizeof(uint8Color)); // qDebug("ImageItem::TransformImage"); cmsHTRANSFORM xform; cmsHPROFILE hIn, hOut; hIn = cmsOpenProfileFromFile(InputProfile.local8Bit(), "r"); hOut = cmsOpenProfileFromFile(OutputProfile.local8Bit(), "r"); xform = cmsCreateTransform(hIn, TYPE_RGB_DBL, hOut, TYPE_RGB_8, intent, cmsFLAGS_WHITEBLACKCOMPENSATION); vigra::DRGBImage::Iterator point=p.upperLeft(); if (uint8lprof) divisor = 255.0; else if (int16lprof) divisor = 65536.0; else if (int32lprof) divisor = 4294967296.0; for (int i=0; i < p.height(); i++) for (int j=0; j < p.width(); j++) { if (uint8lprof | int16lprof | int32lprof) { // scale RGB values to max = 1.0 // since this is what is expected for // floating point images RGB->r = point(j, i).red()/divisor; RGB->g = point(j, i).green()/divisor; RGB->b = point(j, i).blue()/divisor; } else // Floating point image // no rescaling of RGB values needed { RGB->r = point(j, i).red(); RGB->g = point(j, i).green(); RGB->b = point(j, i).blue(); } cmsDoTransform(xform, RGB, rgb, 1); pout.setPixel(j,i, qRgba ( rgb->r, rgb->g, rgb->b, 0xff)); } cmsDeleteTransform(xform); cmsCloseProfile(hIn); cmsCloseProfile(hOut); free(RGB); free(rgb); } |
From: Kai-Uwe B. <ku...@gm...> - 2007-10-24 05:48:37
|
Am 23.10.07, 15:41 -0700 schrieb Lee Howard: > There are a couple of samples of ITULAB JPEG in TIFF here: > > http://bugzilla.remotesensing.org/show_bug.cgi?id=736 Thanks. > Attach the ICC profile into the TIFF? Could you elaborate, please? #include <tiffio.h> TIFFSetField(tif, TIFFTAG_ICCPROFILE, icc_profile_size, icc_profile_ptr); if(TIFFGetField (tif, TIFFTAG_ICCPROFILE, &icc_profile_size, &tiff_owned_ptr)) { char *my_ptr = copyToOwnMemory(icc_profile_size, tiff_owned_ptr); } kind regards Kai-Uwe Behrmann -- developing for colour management www.behrmann.name + www.oyranos.org + www.cinepaint.org |
From: Kai-Uwe B. <ku...@gm...> - 2007-10-26 10:32:11
|
2. try Am 24.10.07, 07:46 +0200 schrieb Kai-Uwe Behrmann: > Am 23.10.07, 15:41 -0700 schrieb Lee Howard: > > There are a couple of samples of ITULAB JPEG in TIFF here: > > > > http://bugzilla.remotesensing.org/show_bug.cgi?id=736 They are broken: Rows/Strip: (infinite) Such tiff's are not properly readable. Can you provide some more relyable test image, probably from colour fax devices? kind regards Kai-Uwe Behrmann -- developing for colour management www.behrmann.name + www.oyranos.org |