ITU T.42 JPEG/Fax profile

 

Here is a icc profile to be used for encoding/decoding ITU T.42 Fax JPEG.

ITU T.42 Fax JPEG (54k)

You need a CMM, this profile and another profile (like sRGB) for your working space.

 

For decoding (display) a ITU T.42 Fax JPEG

* Using your favourite CMM, create a transform from ITUFAX.ICM to your destination color space (sRGB if you don't care).

* Feed the transform with the raw values obtained from the JPEG.

* That's all, the profile will do the necessary decoding and Lab translation, and the transform will return the RGB values to you.

If you are using IJG library (wich I recommend), set the output space to YCbCr, this will prevent IJG code to do any conversion, and return "raw" data.

 

For encoding (store) a ITU T.42 Fax JPEG

* The process is quite similar, you need to create a transform from sRGB (or your working RGB space) to ITUFAX.ICM,

* The CMM will give to you the raw, encoded data ready to be stored.

* The encoding direction, has a additional feature: it clips gamut values between a [-85..85] and b [-75, .. 125] to fit into ITU T.42 spec.

Again, if you are using IJG library, set YCbCr as input space, this will prevent any conversion done by the library.

 

Gamut clipping sample.

This is the original sRGB image, the blue bottle has many parts out of T.42 gamut.

This is the remapped image, the blue bottle has now no parts out of gamut

 

How gamut clipping works.

I'm using LCh (polar form of Lab) to do the clipping.

L = L
C = sqrt(a*a+b*b)
h = atan(b/a)

Where C=colorfulness and h=hue.

L is unchanged and not used. The gamut boundaries are the black rectangle.

I take a Lab value, if inside gamut, don't touch anything, if outside, for example, the
green point, I convert to LCh, keep h constant, and reduce C (in red) until inside
gamut. This gives the second green point, with quite different a, b, but visually similar.

Finally, I wish to thank John Barber for all support and ideas about the stuff, and his modifications to IJG code as well.