[sane-devel] Re: gamma correction procedure

Frank Peters frank.peters@comcast.net
Thu, 26 Feb 2004 11:20:32 -0500


On Thu, 26 Feb 2004 12:17:53 +0100
Stefan Schl=F6rholz <stefan@schloerholz.de> wrote:

>=20
> I would like to know how to implement colour correction at all to sane.=20
> I get much better results from scans under windows in contrast to=20
> Linux. Since I do not have a Wiindows installation any longer I miss=20
> good quality scans under Linux. Under Windows I could go through a=20
> procedure scanning a reference slide.
>=20
> Could you give hints or a description how to proceed to get colour=20
> correction in sane?
>=20

The difference between Linux and MS Windows is that Linux requires
from the user a lot more understanding of the basic concepts.  But=20
with a little bit of motivation and effort, the process is easy to
learn.

However, I can only give a general overview here.  There are lots
of references on this subject available on the web.  A search for
"color management Linux" or just "color management" will provide
many leads.  Also, the SCARSE (http://www.scarse.org) and Little
CMS (http://www.littlecms.com) web pages contain good information.

Basically, the idea is to convert a scanned image from the scanner
color space to the monitor sRGB color space (sRGB is an industry
standard that is built into most recent computer monitors).  For
this, you will need to acquire a calibration target from Coloraid
(http://targets.coloraid.de).  This should be your only investment
of hard cash ($15 US).

The next step is to scan the target using a gamma value of 2.2.
The reason is that gamma 2.2 is very close to the gamma specified
for the sRGB color space.  However, I find that even scanning at
gamma=3D1.0 gives identical final results.  In either case, the
same gamma value must be used consistently with the generated
color profile.

The scanned image, in conjunction with either SCARSE (http://www.scarse.org)
or the Little CMS Profiler (http://www.littlecms.com/profilers.htm),
is then used to produce a color profile (file.icm) for the scanner.
This color profile contains almost all the information that is necessary
to convert the image from scanner color space to the sRGB monitor
color space.  Also needed is a color profile for the sRGB monitor
space.  Basically, every conversion requires _two_ color profiles.
The reason for this is highly technical and won't be discussed here.
(Good explanations can be found on the 'net.)


Scanner Color Space ----------------------> Monitor sRGB Color Space
                       scanner profile
                       monitor profile


Once the image is converted to monitor color space, it can
then be further converted to the color space of a printing
device.


Monitor Space ------------------------>  Printing Space
                  monitor profile
                  printer profile


Or, the scanned image can be directly converted into the
color space of the printing device.


Scanner Space ------------------------> Printing Space
                  scanner profile
                  printer profile


SCARSE and the Little CMS Profiler can generate scanner profiles
and also rough monitor profiles, but quality profiles for most
recent monitors are available from the manufacturer.  The production
of printer profiles requires specialized (and expensive) equipment.
However, some printer manufacturer may supply them directly.

The details of the conversion process are found in the documentation
for each program.  I won't repeat them here.  The difference
between the two programs is that SCARSE uses only the command=20
line while the Little CMS Profiler uses a graphical interface.
Both will produce essentially identical profiles.

There are some further issues with Linux.

SCARSE requires a TIF file for conversion while LCMS PROF needs
the PPM format.  The NETPBM package (http://netpbm.sourceforge.net)
has many versatile image converters and can also be used in
conjunction with a bash script to fully automate the conversion
process.

With the latest glibc libraries, SCARSE no longer compiles under
Linux.  The source code has to be slightly modified.  I would
suggest using a SCARSE rpm package from Mandrake Software
(http://speakeasy.rpmfind.net/linux/RPM/).

Also, the Little CMS Profiler will not compile using the latest
Qt libraries.  Since no rpm is available, I will give the procedure
for modifying the source code.  For all makefiles in the=20
lprof-1.09/qt sub-directories, do the following:

1) Change -lqt to -lqt-mt in the POSTLIB variable.

2) Include the full path (no QTDIR variable) for the UIC and MOC
variables.  These are located at the top of the file.

The program should now compile and provide a nice and easy to use
graphical interface.

If you have any more qestions about the process, just post them to
the list or directly to me off-line.  I will be glad to give
any assistance that I can, but I will also stress that there is
much information to discover on the Internet.

Frank Peters