\ .\" This man page was generated by the Netpbm tool 'makeman' from HTML source. .\" Do not hand-hack it! If you have bug fixes or improvements, please find .\" the corresponding HTML page on the Netpbm website, generate a patch .\" against that, and send it to the Netpbm maintainer. .TH "Pamundice User Manual" 0 "02 January 2026" "netpbm documentation" .SH NAME pamundice - combine grid of images (tiles) into one .UN example .SH EXAMPLE .nf \f(CW $ pamdice myimage.ppm -outstem=myimage_part -width=1000 -height=1000 $ pamundice myimage_part_%1d_%1a.ppm -across=10 -down=8 >myimage.ppm $ pamundice myimage_part_%2a -across=13 -hoverlap=9 \fP .fi .PP See .UR pamdice.html#example pamdice .UE \& for more examples. .UN synopsis .SH SYNOPSIS \fBpamundice\fP { [\fB-across=\fP\fIn\fP] [\fB-down=\fP\fIn\fP] , \fB-indexfile=pamfilename\fP } [\fB-hoverlap=\fP\fIpixels\fP] [\fB-voverlap=\fP\fIpixels\fP] [\fB-verbose\fP] {\fIinput_filename_pattern\fP, \fB-listfile=\fP\fItextfilename\fP} .PP You can use the minimum unique abbreviation of the options. You can use two hyphens instead of one. You can separate an option name from its value with white space instead of an equals sign. .UN description .SH DESCRIPTION .PP This program is part of .BR "Netpbm" (1)\c \&. .PP \fBpamundice\fP reads a bunch of Netpbm images as input and combines them as a grid of tiles into a single output image of the same kind on Standard Output. .PP You can optionally make the pieces overlap. .PP The pieces don't have to be distinct; you can make a single input image appear multiple places in the output grid. .PP The images can either be in files whose names indicate where they go in the output (e.g. 'myimage_part_03_04' could be the image for Row 3, Column 4 - see the \fIinput_filename_pattern\fP argument) or listed in a file, with a \fB-listfile\fP option. .PP The input images must all have the same format (PAM, PPM, etc.) and maxval and for PAM must have the same depth and tuple type. All the images in a rank (horizontal row of tiles) must have the same height. All the images in a file (vertical column of tiles) must have the same width. But it is not required that every rank have the same height or every file have the same width. .PP \fBpamdice\fP is the inverse of \fBpamundice\fP. You can use \fBpamundice\fP to reassemble an image sliced up by \fBpamdice\fP. You can use \fBpamdice\fP to recreate the tiles of an image created by \fBpamundice\fP, but to do this, the original ranks must all have been the same height except for the bottom one and the original files must all have been the same width except the right one. .PP One use for this is to process an image in pieces when the whole image is too large to process. For example, you might have an image so large that an image editor can't read it all into memory or processes it very slowly. You can split it into smaller pieces with \fBpamdice\fP, edit one at a time, and then reassemble them with \fBpamundice\fP. .PP Of course, you can also use \fBpamundice\fP to compose various kinds of checkerboard images, for example, you could write a program to render a chessboard by computing an image of each square, then using \fBpamundice\fP to assemble them into a board. .PP An alternative to join images in a single direction (i.e. a single rank or a single file) is \fBpamcat\fP. \fBpamcat\fP provides alternative ways to identify the input images: you can supply them serially on Standard Input or list them by name as command line arguments. .PP To join piecewise photographs, use \fBpnmstitch\fP instead of \fBpamundice\fP, because it figures out where the pieces overlap, even if they don't overlap exactly vertically or horizontally. .PP To create an image of the same tile repeated in a grid, that's \fBpnmtile\fP. .PP \fBpnmindex\fP does a similar thing to \fBpamundice\fP: it combines a bunch of small images in a grid into a big one. But its purpose is to produce an index image of the input images. So it leaves space between them and has labels for them, for example. .UN arguments .SH ARGUMENTS .PP Unless you use a \fB-listfile\fP option, there is one non-option argument, and it is mandatory: \fIinput_filename_pattern\fP. This tells \fBpamundice\fP what files contain the input tiles. .PP \fBpamundice\fP reads the input images from files which are named with a pattern that indicates their positions in the combined image. For example, \fBtile_00_05.ppm\fP could be the 6th tile over in the 1st rank, while \fBtile_04_01\fP is the 2nd tile over in the 5th rank. .PP (But see \fB-indexfile\fP, which can cause the tiles to be rearranged so that the file whose name indicates it is the 6th tile over in the 1st rank could actually be placed by \fBpamundice\fP in any arbitrary position in its output). .PP You cannot supply any of the data on Standard Input, and the files must be the kind that \fBpamundice\fP can close and reopen and read the same image a second time (e.g. a regular file is fine; a named pipe is probably not). .PP \fIinput_filename_pattern\fP is a printf-style pattern. (See the standard C library \fBprintf\fP subroutine). For the example above, it would be \fBtile_%2d_%2a.ppm\fP. The only possible conversion specifiers are: .TP \fBd\fP "down": The rank (row) number, starting with 0. .TP \fBa\fP "across": The file (column) number, starting with 0. .TP \fB%\fP The per cent character (%). .PP The number between the % and the conversion specifier is the precision and is required. It says how many characters of the file name are described by that conversion. The rank or file number is filled with leading zeroes as necessary. .PP So the example \fBtile_%2d_%2a.ppm\fP means to get the name of the file that contains the tile at Rank 0, File 5, you: .IP \(bu replace the "%2d" with the rank number, as a 2 digit decimal number: "00" .IP \(bu Replace the "%2a" with the file number, as a 2 digit decimal number: "05" .PP Note that this particular pattern describes file names that \fBpamdice\fP produces, except that the precision may be more or less. (See the \fB-numberwidth\fP option of \fBpamdice\fP). .PP Note that a pattern with no %d or no %a effects a replication. .UN options .SH OPTIONS .PP In addition to the options common to all programs based on libnetpbm (most notably \fB-quiet\fP, see .UR index.html#commonoptions Common Options .UE \&), \fBpamundice\fP recognizes the following command line options: .TP \fB-across=\fP\fIN\fP This is the number of tiles across in the grid, i.e. the number of tiles in each rank, or the number of files. .sp You cannot specify this together with \fB-indexfile\fP. .sp Default is 1. .TP \fB-down=\fP\fIN\fP This is the number of tiles up and down in the grid, i.e. the number of tiles in each file, or the number of ranks. .sp You cannot specify this together with \fB-indexfile\fP. .sp Default is 1. .TP \fB-hoverlap=\fP\fIpixels\fP This is the amount in pixels to overlap the tiles horizontally. \fBpamundice\fP clips this much off the right edge of every tile before joining it to the adjacent image to the right. The tiles along the right edge remain whole. .sp There must not be any input image narrower than this. .sp Note that this undoes the effect of the same \fB-hoverlap\fP option of \fBpamdice\fP. .sp Default is zero -- no overlap. .TP \fB-voverlap=\fP\fIpixels\fP This is analogous to \fB-hoverlap\fP, but \fBpamundice\fP clips the bottom edge of each image before joining it to the one below. .TP \fB-listfile=\fP\fItextfilename\fP This option names a file that contains the names of all the input files. This is an alternative to specifying a file name pattern as an argument. .sp The named file contains file names, one per line. Each file contains the image for one tile, in row-major order, top to bottom, left to right. So the first file is the upper left tile, the second is the one to right of that, etc. The number of lines in the file must be equal to the number of tiles in the output, the product of the \fB-across\fP and \fB-down\fP values. .sp The file names have no meaning to \fBpamundice\fP. You can list the same file multiple times to have identical tiles in the output. .sp If you create the tile files with \fBpamdice\fP, you can use the \fB-listfile\fP option of \fBpamdice\fP to produce a suitable list file for reassembling the tiles into the same positions they had in the original large image. .sp You cannot specify this together with \fB-indexfile\fP. .sp This option was new in Netpbm 10.90 (March 2020). .TP \fB-indexfile=\fP\fIpamfilename\fP This option names a file that contains a PAM image that tells which tile files to put where in the assembled output. See the \fBpamdice\fP \fB-indexfile\fP option for details on its format. .sp A typical way to generate an index image to use with \fBpamundice\fP is to use the \fB-indexfile\fP option of \fBpamdice\fP, and then possibly manipulate the resulting index image with other Netpbm tools. .sp While the sample values in the index image are defined to be rank and file positions in some original large image, and so are documented in those terms, in practice, \fBpamundice\fP doesn't assign any meaning to the numbers -- they are just substitutions for two variables in the input file name pattern (given as a program argument). .sp The maxval of the index image is irrelevant, except that no sample in the index image can be greater than it. .sp The depth of the index file must be at least two (rank and file), but the program ignores any additional planes. .sp The program ignores the tuple type. .sp If you don't specify this option, the position of a tile in the ouput is given directly by the rank and file portions of the tile file name, or if you specify \fB-listfile\fP, by order in which the tile files are listed in the list file. .sp You cannot specify this together with \fB-listfile\fP, \fB-down\fP, or \fB-across\fP. .sp This option was new in Netpbm 11.10 (March 2025). .TP \fB-verbose\fP This says to print information about the processing to Standard Error. .UN usage .SH Usage .PP Here is an example of using a list file: .nf \f(CW Example usage of -listfile: pamdice -width=100 -height=100 -outstem=img_part -listfile=listfile \e img.ppm pamundice -listfile=listfile -across=6 -down=4 > img_copy.ppm \fP .fi .PP Note that in the above example, you have to know somehow that you got 6 files and 4 ranks from \fBpamdice\fP and then specify the correct \fB-across\fP and \fB-down\fP options on \fBpamundice\fP. A slight error ruins the process. A better way is to use \fB-indexfile\fP: .nf \f(CW pamdice -width=100 -height=100 -outstem=img_part \e -numberwidth=3 -indexfile=index.pam img.pam pamundice -indexfile=index.pam img_part_%3d_%3a.pam > img_copy.pam \fP .fi .PP Here is an example of flipping a large image. \fBpamflip\fP often requires the entire image to be in real memory at once, which can be impossible or impractical with a very large image. This method does it in smaller pieces so as to require less memory: .nf \f(CW Example of -indexfile with pamflip operation: pamdice -width=2500 -height=2500 -outstem=tile \e -numberwidth=3 -indexfile=index.pam hugeImage.ppm # flip every tile for tile in tile_???_???.ppm do pamflip -r180 $tile > ${tile%.ppm}.flipped.ppm done # flip indexfile - Simply apply the same flip operation pamflip -r180 index.pam > index_flipped.pam pamundice -indexfile=index_flipped.pam tile_%3d_%3a.flipped.ppm \e > hugeImage_flipped.ppm \fP .fi .UN history .SH HISTORY .PP \fBpamundice\fP was new in Netpbm 10.39 (June 2007). Before that, \fBpamcat\fP is the best substitute. .UN seealso .SH SEE ALSO .BR "pamdice" (1)\c \&, .BR "pamcat" (1)\c \&, .BR "pnmindex" (1)\c \&, .BR "pnmtile" (1)\c \&, .BR "pnmtile" (1)\c \&, .BR "pnm" (1)\c \&, .BR "pam" (1)\c \& .SH DOCUMENT SOURCE This manual page was generated by the Netpbm tool 'makeman' from HTML source. The master documentation is at .IP .B http://netpbm.sourceforge.net/doc/pamundice.html .PP