PAMTILT(1)
π PAMTILT π
okay bestie, welcome to the Pamtilt User Manual, straight out of the General Commands Manual section. this one's a lil utility that lives in the Netpbm-verse and it is lowkey iconic if your scans are crooked. let's get into it β¨
πΈ NAME πΈ
pamtilt β bestie, it prints the tilt angle of a PGM file. that's it. that's the whole job. π
β¨ SYNOPSIS β¨
pamtilt [-angle=maxangle] [-fast] [-quality=q] [-hstep=n] [-vstep=n]
[-dstep=n] [-astep=n] [-verbose] [pgmfile]
π§ EXAMPLES π§
this is the whole glow-up pipeline fr fr:
scanimage --mode Gray --resolution 300 >crooked.pgm
pnmrotate -b white `pamtilt crooked.pgm` crooked.pgm >straight.pgm
(then crop, threshold, etc.)
like, you scan it crooked, you ask pamtilt what the angle is, you feed that angle straight into pnmrotate, and boom π
then you crop, threshold, etc. etc. the rest is up to you.
π DESCRIPTION π
okay so first thing: this program is part of Netpbm(1). say it with me now β part of Netpbm. π«Ά
pamtilt tries to find the correct angle for untilting (de-skewing) a scanned text document. it prints out a single floating-point number β that's the angle in degrees β and that number is literally built to be the argument for pnmrotate. no cap.
so "Document skew" is the fancy name for when you feed a page into an image scanner at an angle and the resulting image comes out tilted. embarrassing honestly. pamtilt is here to help correct that πβ¨
the way it works: pamtilt makes three iterations at successively finer increments, testing prospective rotation angles to find the best one. and bestie, be honest with yourself β it works best for straightening images with strong horizontal lines, and it does poorly with arbitrary photos. it's a text-document girlie, not a portrait photographer, okay? π
and if pamtilt has no confidence in its results, it prints the special value 00.00. iconic of it to just say "idk". you can check for that, or honestly just pass it as a legal argument to pnmrotate and vibe.
pamtilt operates on the first plane of the input image β and the input is either PNM or PAM β and it ignores any other planes. ordinarily the input is PGM or GRAYSCALE PAM, so there's only one plane and this whole thing is a non-issue. π
it also works on bilevel images (PBM, BLACKANDWHITE PAM) as well as grayscale, but β listen β you will minimize artifacts if you scan and rotate in grayscale before you apply a threshold to make a bilevel image. do it in that order, trust. π
π OPTIONS π
in addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pamtilt recognizes the following command line options:
-angle=maxangleβ assume a maximum tilt angle ofmaxangle, measured in degrees. the default value is sufficient for most images, even those scanned somewhat carelessly (we've all been there). the default is10.0.-fastβ skip the third iteration. speed at the expense of accuracy, the classic tradeoff, the eternal struggle. π¨-verboseβ show on Standard Error the measurements computed at each tested angle. nosy in the best way. π
here are some other options you can use to tune the operation of pamtilt, but bestie they're seldom needed. the default values accommodate a wide variety of input documents, so you probably never have to touch these. but they're here if you wanna get fancy:
-quality=qβ require a signal-to-noise ratio of at leastqon the first iteration to report a valid result. larger values reduce the chances of obtaining a bogus result, at the risk of obtaining no result at all. pick your poison, queen. the default is1.0.-hstep=nβ set the horizontal increment to check every *n*th column. this value affects both run time and memory requirements. the default is11.-vstep=nβ set the vertical increment to check every *n*th row. larger values usually work and reduce run time, but they increase the risk of incorrect results. highkey a gamble. the default is5.-dstep=nβ set the vertical distance used when checking pixels in a column. the default is intended to minimize the effect of noise along a horizontal boundary. the default is2.-astep=nβ set the angle increment of the first iteration, in degrees. the default is1.0.
π REFERENCES π
pamtilt implements a somewhat simplified algorithm inspired by: "Measuring Document Image Skew and Orientation", by Bloomberg, Kopec, and Dasari. In SPIE Volume 2422, Document Recognition II, pages 302-316, February 1995. academic queen behavior, we love to see it π
π SEE ALSO π
pnmrotate(1)pgm(1)
π¦ HISTORY π¦
pamtilt was new in Netpbm 10.30 (October 2005). a legend was born β¨
Gregg Townsend wrote it and sent it to Bryan Henderson in August 2005. Bryan recoded it to fit Netpbm conventions. collaborative king energy fr fr π«Ά
π DOCUMENT SOURCE π
this manual page was generated by the Netpbm tool makeman from HTML source. the master documentation is at
http://netpbm.sourceforge.net/doc/pamtilt.html
and that's the whole thing, bestie!! this was netpbm documentation, dated 28 August 2005 β the Pamtilt User Manual era, a vibe, a moment, a slay. go straighten some scans πβ¨ππ¦πΈπ
π¦ where this page comes from
- debian trixie: netpbm 2:11.10.02-1 Β· MIT
- ubuntu resolute: netpbm 2:11.10.02-1build1 Β· MIT
- ubuntu stonking: netpbm 2:11.13.03+ds-2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms