Pamrestack User Manual

# pamrestack

Updated:
Table Of Contents

## NAME

pamrestack - Rearrange rows of a Netpbm image

## SYNOPSIS

pamrestack [-width=width] [-trim={fill|crop|abort}] [-verbose] [pamfile]

Minimum unique abbreviations of option are acceptable. You may use double hyphens instead of single hyphen to denote options. You may use white space in place of the equals sign to separate an option name from its value.

## DESCRIPTION

This program is part of Netpbm.

pamrestack rearranges the pixels of a Netpbm image into different size rows. E.g. if an image is 100 pixels wide and 50 pixels high, you can rearrange it to 125 wide and 40 high. In that case, 25 pixels from the start of the 2nd row of the input would be moved to the end of the 1st row of input, 50 pixels from the 3rd row would be moved to the 2nd row, etc.

Put another way, pamrestack arranges all the input rows into one long sequence and produces output rows therefrom, in FIFO order.

Input is from Standard Input if you don't specify the input file pamfile.

Output is to Standard Output.

pamrestack works on a multi-image stream. It cuts each image in the stream independently and produces a multi-image stream output.

## OPTIONS

In addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pamrestack recognizes the following command line options:

-width=width
  The width of the output. If this option is not specified, the output will consist of a single row wide enough to contain all the pixels of the input image.
-trim={fill|crop|abort}
  This option specifies what to do when the new width does not cleanly divide the number of pixels in the input image.
  fill
    (Default) Complete the final row by adding black pixels as necessary.
  crop
    Discard the final partial row. If this means there is nothing to output, fail the program.
  abort
    Fail the program..
-verbose
  Print information about the processing to Standard Error.

## USAGE

pamrestack is a general editor with many possible uses.

- pamrestack can rearrange into rectangles single-dimention images produced by programs such as ppmhist and pamseq. This makes the output easier to examine with a viewer. Conversely, pamrestack can be used to convert a normal rectangular image into one wide row or one tall column if that is desireable for compression, conversion, or analysis.
- pamrestack can repair images corrupted by an incorrect width value in the header. Images grabbed from the framebuffer device often exhibit this problem.
- pamrestack can be used with pamdice, pamundice, pnmcat, etc. to divide and combine images in the process of interlacing.

## EXAMPLES

- Rearrange the one-dimensional output of pamseq into a square:

      pamseq 3 255 | pamrestack -width=4096

- Combine two files, each 600 pixels wide, one with the odd rows and another with the even rows, to construct an interlaced image:

      pnmcat -leftright oddrows.ppm evenrows.ppm | pamrestack -width=600

- Like the above, but invert all pixels in the even rows left to right to produce a serpentine interlace:

        pamflip -leftright evenrows.ppm |
          pnmcat -leftright oddrows.ppm - |
            pamrestack -width 600

## SEE ALSO

pamseq, ppmhist, pnmshear, pamdeinterlace, pamdice, pamundice, pnmcat, pam

## HISTORY

pamrestack was new in Netpbm 10.99 (June 2022).

## AUTHOR

By Akira F. Urushibata. Contributed to the public domain by the author.

## Table Of Contents

- SYNOPSIS
- DESCRIPTION
- OPTIONS
- USAGE
- EXAMPLES
- SEE ALSO
- HISTORY
- AUTHOR