pnmfix

NAME

pnmfix - fix the header of PNM images depending on the image content

pnmfix.tar.bz2 (latest version: 31-Mar-2013)

SYNOPSIS

scanimage | pnmfix [options] > pnmfile.pnm

DESCRIPTION

The problem when using scanimage is that quite often the resulting files are malformed and cannot be read by a lot of image processing applications, such as cjpeg or GIMP (cf SEE ALSO). The problem often occurs when using an ADF, an automatic document feeder. When the scan begins (and thus the header of the resulting image file is being written) the scanner nor the scanimage tool does know the exact properties of the scanned sample. Consequently, the file’s header is based on user specified properties (such as -x width or -y height of the scan-area). One possible solution would be to hold all the scan data im memory until the exact dimensions are known, however that may prove unfeasible with high resolutions scans.

Another possible solution would be to correct the image dimensions as part of the post-processing workflow, what pnmfix is for, thus creating valid output.

The usage of pnmfix is simple: pnmfix reads the image on stdin, writes the image with a correct header to stdout, and prints any diagnostic messages to stderr. If no correction is needed, stdin and stdout are bit identical.

EXAMPLES

The typical workflow depends on the user’s needs:

  1. The output of scanimage may be piped to pnmfix right away, or
  2. scanimage writes the output to a file, and pnmfix is called later on that file.

Example: Scan and fix in a single step.

scanimage | pnmfix > fixed-file.pnm

Example: Use pnmfix standalone.

pnmfix < infile > outfile

Example: Scan and fix image, and convert to JPEG in a single step.

scanimage | pnmfix | cjpeg > out.jpg

OPTIONS

--verbose

Print information about the image header, and whether it needs to be corrected. Verbose is not the default, it can be enabled with --verbose=true and disabled with --verbose=false.

SEE ALSO

scanimage(1), sane(7), cjpeg(1), jpegtran(1), Debian bug #236507

privacy information