LinuxCommandLibrary

gamma4scanimage

Calibrate scanner gamma for accurate scan images

SYNOPSIS

gamma4scanimage [-h] [-v] [-d device] [-b backend] [-m mode] [-r resolution] [-s strips] [output.tbl]

PARAMETERS

-h, --help
    Display usage summary and exit

-v, --verbose
    Enable verbose logging

-d DEVICE, --device=DEVICE
    Specify SANE scanner device (e.g., 'epson:libusb:001:002')

-b BACKEND, --backend=BACKEND
    SANE backend name (e.g., 'epson2', autodetects if omitted)

-m MODE, --mode=MODE
    Scan mode: Color|Gray|Lineart (default: Gray)

-r RES, --resolution=RES
    Scan resolution in DPI (default: 300)

-s NUM, --strips=NUM
    Number of test strips (4-64, default: 16)

output.tbl
    Output gamma table file (stdout if omitted)

DESCRIPTION

gamma4scanimage is a specialized utility for calibrating the gamma response of flatbed scanners using the SANE (Scanner Access Now Easy) backend. It assists users in creating custom gamma lookup tables (LUTs) to correct non-linear color and grayscale responses, improving scan accuracy for photographic or document work.

The process is interactive: the tool generates and instructs printing of test patterns with graduated gray or color strips on a standard printer. Users then scan these patterns using their scanner device via scanimage. gamma4scanimage analyzes the scanned PNM images to compute the inverse gamma curve, outputting a binary table file usable with scanimage's --gamma-table option.

This is particularly useful for scanners exhibiting gamma distortion (e.g., Epson models), ensuring linear tonal response. It supports RGB, grayscale, lineart modes, and multiple resolutions. The resulting tables enhance dynamic range and color fidelity without hardware tweaks. Primarily used by advanced users or in automated workflows; requires Perl, Netpbm tools, and a configured SANE backend.

CAVEATS

Requires printer access, SANE backend support for gamma tables, and Netpbm/PNM tools. Interactive scanning prompts assume manual intervention; test patterns must be printed accurately on matte paper to avoid reflections. Not all backends support gamma LUTs. Root may be needed for USB devices.

USAGE WORKFLOW

1. Run gamma4scanimage -b yourbackend -m Gray to print test chart.
2. Scan printed chart per prompts.
3. Table saved; use as scanimage --gamma-table table.tbl ...

DEPENDENCIES

Perl 5, Netpbm (pnmtopng, pgmtoppm), Ghostscript for PDF charts, functional SANE backend.

HISTORY

Developed by Oliver Schwartz circa 2001 as a Perl script for SANE 1.0.x. Enhanced in SANE 1.0.19+ for better backend integration. Maintained sporadically; bundled in sane-frontends or distro packages like Debian's sane-utils.

SEE ALSO

scanimage(1), sane(7), pnm(5), xsane(1)

Copied to clipboard