[sane-devel] PIXMA: Gamma Value & Table

Rolf Bensch rolf at bensch-online.de
Sat Jun 6 10:59:23 BST 2020


Hi PIXMA Users,

I just reworked gamma table calculation. Not all PIXMA scanners need
gamma tables. You can check if your scanner's capabilities with:

$ scanimage --help

So far internal gamma table generation was flawed. Now it produces
feasible results close to Canon's gamma table calculation.

Simply you can use the ideal gamma setting for your scanner, e.g. for
gamma = 2.5:

$ scanimage --gamma 2.5 > test.pnm

Now it becomes a little bit tricky. You can ignore following if you
don't need self generated gamma tables.

PIXMA backend uses two kinds of gamma tables. Old generation 1 scanners
need a table with 4096 * 8bit values. Newer scanners use gamma tables
with 1024 * 16bit values.

You can check your scanner's capabilities with '$ scanimage --help'. You
may see this for 1024 * 16bit tables:

$ scanimage --help
[...]
  Gamma:
    --custom-gamma[=(auto|yes|no)] [no]
        Determines whether a builtin or a custom gamma-table should be used.
    --gamma-table auto|0..65535,... [inactive]
        Gamma-correction table with 1024 entries. In color mode this option
        equally affects the red, green, and blue channels simultaneously
(i.e.,
        it is an intensity gamma table).
    --gamma auto|0.299988..5 [2.2]
        Changes intensity of midtones
[...]

"--gamma-table auto" creates the same table as simply using "--gamma".

Using "--gamma-table" needs "--custom-gamma=true", e.g.

$ scanimage --custom-gamma=yes --gamma-table [0]0-[1023]65535 > test.pnm

generates a linear gamma table from 0 ... 65525 for generation >= 2
scanners.

You can generate your own gamma table with 'gamma4scanimage', e.g.

$ scanimage --custom-gamma=yes --gamma-table `gamma4scanimage 2.2 0 1023
1023 65535` > test.pnm

generates a table close to our internal generated table with gamma=2.2.

Please read '$ man gamma4scanimage' for details.

Hope this helps.

Cheers,
Rolf





More information about the sane-devel mailing list