LinuxCommandLibrary

pamstretch-gen

Generate PAM mapping file for image stretching

TLDR

Scale up a PAM image by the specified decimal factor

$ pamstretch-gen [n] [path/to/image.pam] > [path/to/output.pam]
copy

SYNOPSIS

pamstretch-gen nframes [nfuzz]

PARAMETERS

nframes
    Integer ≥ 2 specifying the number of images (frames) in the horizontal panorama strip.

nfuzz
    Optional floating-point fraction (0.0-1.0, default 0.05) for maximum positional deviation to reduce aliasing artifacts.

DESCRIPTION

The pamstretch-gen command is a utility from the Netpbm suite designed to generate the precise command-line arguments needed for pamstretch to stretch the first image in a horizontal panorama strip. This ensures seamless stitching with subsequent images by accounting for optical distortions common in wide-angle photography, such as barrel distortion.

It outputs options like --blackedges -xstretch=1.234,1.456,..., which specify varying horizontal stretch factors across the image width. These factors are calculated assuming a linear distortion model where edge pixels are stretched more than center ones.

Usage typically involves piping the output directly to pamstretch or saving it for batch processing. For example, generate args for a 10-frame panorama, then apply to the first PAM image before stitching the strip with tools like pnmcat or panorama software.

The tool assumes all images in the strip have identical height and that distortion is symmetric. It's particularly useful for creating high-quality cylindrical or spherical panoramas from consumer camera grids. Limitations include no support for vertical strips or complex distortions; users may need custom scripts for advanced cases. Requires Netpbm libraries.

CAVEATS

Outputs to stdout only; redirect or pipe as needed. Assumes uniform image height and symmetric distortion. No vertical stretching support. nfuzz too high may cause over-stretching.

EXAMPLE

pamstretch-gen 5 0.03 > args.txt
pamstretch `cat args.txt` first.pam > stretched.pam
Stitch with: pnmcat -lr stretched.pam img2.pam img3.pam img4.pam img5.pam

HISTORY

Developed by Bryan Henderson as part of the Netpbm project around 2005. Evolved from early panorama tools in PBMPLUS (1990s), now maintained in Netpbm 10+ for portable image manipulation.

SEE ALSO

pamstretch(1), pnmcat(1), pam(5)

Copied to clipboard