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. > > [EMAIL PROTECTED] lcms-1.17]# file samples/itufax.icm > samples/itufax.icm: Kodak Color Management System, ICC Profile > [EMAIL PROTECTED] 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); } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user