pamfixtrunc
Fix PAM config file truncation issues
TLDR
View documentation for the current command
SYNOPSIS
pamfixtrunc [width] [pam input]
PARAMETERS
width
Specifies the exact width (in pixels) that all rows in the output image should have. If this argument is omitted, pamfixtrunc attempts to automatically determine the correct width by examining the first non-truncated row it finds in the input. If no such row can be found (e.g., all rows are truncated, or the image consists of only a single truncated row), an error will occur, and an explicit width must be provided.
pam input
The path to the Netpbm image file that needs processing. If this argument is not provided, pamfixtrunc will read the image data from standard input (stdin). This allows it to be easily integrated into command pipelines.
DESCRIPTION
pamfixtrunc is a specialized utility from the Netpbm suite designed to repair Netpbm image files that suffer from malformed rows. It addresses two primary issues: rows that are too short (truncated) and rows that are too long. When a row is truncated, pamfixtrunc intelligently pads it with black pixels to reach the correct image width. Conversely, if a row exceeds the specified or inferred width, it is trimmed to the correct length. This tool is invaluable for correcting image files produced by buggy software that might write incomplete data rows, or for files that become corrupted during transfer, leading to partial or oversized row data. It can infer the correct image width from the first complete row encountered, but requires an explicit width argument if all rows are malformed or if the image is a single, truncated row. It operates as a filter, reading image data from standard input and outputting the corrected image to standard output.
CAVEATS
If you do not specify the width argument and the input Netpbm image contains only truncated rows, or is simply a single truncated row, pamfixtrunc will be unable to determine the correct image width automatically. In such scenarios, the command will fail, and you must explicitly provide the desired width as a command-line argument.
STANDARD I/O OPERATION
True to the Unix philosophy, pamfixtrunc functions as a filter. It reads image data from standard input by default and writes the processed, corrected image to standard output. This design makes it highly versatile for use in shell pipelines, allowing it to be combined seamlessly with other Netpbm utilities or general-purpose Unix commands for complex image processing workflows.
SUPPORTED IMAGE FORMATS
Being a Netpbm utility, pamfixtrunc is compatible with all Netpbm image formats. This includes PBM (Portable Bitmap), PGM (Portable Graymap), PPM (Portable Pixmap), and PAM (Portable Arbitrary Map). It internally processes all inputs as PAM format and outputs a PAM image, ensuring broad compatibility within the Netpbm ecosystem.
HISTORY
pamfixtrunc is an integral part of the Netpbm suite, a venerable and comprehensive collection of graphics manipulation tools for Unix and Linux systems. The Netpbm project originated from the PBMplus toolkit in the early 1990s and has since undergone continuous development, maintaining its focus on simple, pipe-friendly image filters. pamfixtrunc addresses a specific and practical problem of corrupted or malformed image data streams, reflecting the suite's robust approach to handling diverse image inputs.
SEE ALSO
pnm(5), pam(5), pamscale(1), pnmcut(1), pamstretch(1)