| 1 |
\ |
| 2 |
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source. |
| 3 |
.\" Do not hand-hack it! If you have bug fixes or improvements, please find |
| 4 |
.\" the corresponding HTML page on the Netpbm website, generate a patch |
| 5 |
.\" against that, and send it to the Netpbm maintainer. |
| 6 |
.TH "Pamundice User Manual" 1 "02 January 2026" "netpbm documentation" |
| 7 |
|
| 8 |
.SH NAME |
| 9 |
pamundice - combine grid of images (tiles) into one |
| 10 |
|
| 11 |
.UN example |
| 12 |
.SH EXAMPLE |
| 13 |
|
| 14 |
.nf |
| 15 |
\f(CW |
| 16 |
$ pamdice myimage.ppm -outstem=myimage_part -width=1000 -height=1000 |
| 17 |
$ pamundice myimage_part_%1d_%1a.ppm -across=10 -down=8 >myimage.ppm |
| 18 |
|
| 19 |
$ pamundice myimage_part_%2a -across=13 -hoverlap=9 |
| 20 |
\fP |
| 21 |
|
| 22 |
.fi |
| 23 |
.PP |
| 24 |
See |
| 25 |
.UR pamdice.html#example |
| 26 |
pamdice |
| 27 |
.UE |
| 28 |
\& for more examples. |
| 29 |
|
| 30 |
.UN synopsis |
| 31 |
.SH SYNOPSIS |
| 32 |
|
| 33 |
\fBpamundice\fP |
| 34 |
|
| 35 |
{ |
| 36 |
[\fB-across=\fP\fIn\fP] |
| 37 |
|
| 38 |
[\fB-down=\fP\fIn\fP] |
| 39 |
, |
| 40 |
\fB-indexfile=pamfilename\fP |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
[\fB-hoverlap=\fP\fIpixels\fP] |
| 45 |
|
| 46 |
[\fB-voverlap=\fP\fIpixels\fP] |
| 47 |
|
| 48 |
[\fB-verbose\fP] |
| 49 |
|
| 50 |
{\fIinput_filename_pattern\fP, |
| 51 |
\fB-listfile=\fP\fItextfilename\fP} |
| 52 |
.PP |
| 53 |
You can use the minimum unique abbreviation of the options. You can use |
| 54 |
two hyphens instead of one. You can separate an option name from its value |
| 55 |
with white space instead of an equals sign. |
| 56 |
|
| 57 |
.UN description |
| 58 |
.SH DESCRIPTION |
| 59 |
.PP |
| 60 |
This program is part of |
| 61 |
.BR "Netpbm" (1)\c |
| 62 |
\&. |
| 63 |
.PP |
| 64 |
\fBpamundice\fP reads a bunch of Netpbm images as input and combines them |
| 65 |
as a grid of tiles into a single output image of the same kind on Standard |
| 66 |
Output. |
| 67 |
.PP |
| 68 |
You can optionally make the pieces overlap. |
| 69 |
.PP |
| 70 |
The pieces don't have to be distinct; you can make a single input |
| 71 |
image appear multiple places in the output grid. |
| 72 |
|
| 73 |
.PP |
| 74 |
The images can either be in files whose names indicate where they go in the |
| 75 |
output (e.g. 'myimage_part_03_04' could be the image for Row 3, |
| 76 |
Column 4 - see the \fIinput_filename_pattern\fP argument) or listed in a |
| 77 |
file, with a \fB-listfile\fP option. |
| 78 |
.PP |
| 79 |
The input images must all have the same format (PAM, PPM, etc.) |
| 80 |
and maxval and for PAM must have the same depth and tuple type. |
| 81 |
All the images in a rank (horizontal row of tiles) must have the |
| 82 |
same height. All the images in a file (vertical column of tiles) |
| 83 |
must have the same width. But it is not required that every rank |
| 84 |
have the same height or every file have the same width. |
| 85 |
.PP |
| 86 |
\fBpamdice\fP is the inverse of \fBpamundice\fP. You can use |
| 87 |
\fBpamundice\fP to reassemble an image sliced up by \fBpamdice\fP. |
| 88 |
You can use \fBpamdice\fP to recreate the tiles of an image created |
| 89 |
by \fBpamundice\fP, but to do this, the original ranks must all have |
| 90 |
been the same height except for the bottom one and the original files |
| 91 |
must all have been the same width except the right one. |
| 92 |
.PP |
| 93 |
One use for this is to process an image in pieces when the whole image is |
| 94 |
too large to process. For example, you might have an image so large that an |
| 95 |
image editor can't read it all into memory or processes it very slowly. You |
| 96 |
can split it into smaller pieces with \fBpamdice\fP, edit one at a time, and |
| 97 |
then reassemble them with \fBpamundice\fP. |
| 98 |
.PP |
| 99 |
Of course, you can also use \fBpamundice\fP to compose various kinds of |
| 100 |
checkerboard images, for example, you could write a program to render a |
| 101 |
chessboard by computing an image of each square, then using \fBpamundice\fP |
| 102 |
to assemble them into a board. |
| 103 |
|
| 104 |
.PP |
| 105 |
An alternative to join images in a single direction (i.e. a single rank or |
| 106 |
a single file) is \fBpamcat\fP. \fBpamcat\fP provides alternative ways to |
| 107 |
identify the input images: you can supply them serially on Standard Input or |
| 108 |
list them by name as command line arguments. |
| 109 |
.PP |
| 110 |
To join piecewise photographs, use \fBpnmstitch\fP instead of |
| 111 |
\fBpamundice\fP, because it figures out where the pieces overlap, even if |
| 112 |
they don't overlap exactly vertically or horizontally. |
| 113 |
.PP |
| 114 |
To create an image of the same tile repeated in a grid, that's |
| 115 |
\fBpnmtile\fP. |
| 116 |
.PP |
| 117 |
\fBpnmindex\fP does a similar thing to \fBpamundice\fP: it combines a |
| 118 |
bunch of small images in a grid into a big one. But its purpose is to produce |
| 119 |
an index image of the input images. So it leaves space between them and has |
| 120 |
labels for them, for example. |
| 121 |
|
| 122 |
|
| 123 |
.UN arguments |
| 124 |
.SH ARGUMENTS |
| 125 |
.PP |
| 126 |
Unless you use a \fB-listfile\fP option, there is one non-option |
| 127 |
argument, and it is mandatory: \fIinput_filename_pattern\fP. This |
| 128 |
tells \fBpamundice\fP what files contain the input tiles. |
| 129 |
.PP |
| 130 |
\fBpamundice\fP reads the input images from files which are named |
| 131 |
with a pattern that indicates their positions in the combined image. |
| 132 |
For example, \fBtile_00_05.ppm\fP could be the 6th tile over in the |
| 133 |
1st rank, while \fBtile_04_01\fP is the 2nd tile over in the 5th rank. |
| 134 |
.PP |
| 135 |
(But see \fB-indexfile\fP, which can cause the tiles to be rearranged so |
| 136 |
that the file whose name indicates it is the 6th tile over in the 1st rank |
| 137 |
could actually be placed by \fBpamundice\fP in any arbitrary position in its |
| 138 |
output). |
| 139 |
|
| 140 |
.PP |
| 141 |
You cannot supply any of the data on Standard Input, and the files |
| 142 |
must be the kind that \fBpamundice\fP can close and reopen and read |
| 143 |
the same image a second time (e.g. a regular file is fine; a named |
| 144 |
pipe is probably not). |
| 145 |
.PP |
| 146 |
\fIinput_filename_pattern\fP is a printf-style pattern. (See the |
| 147 |
standard C library \fBprintf\fP subroutine). For the example above, |
| 148 |
it would be \fBtile_%2d_%2a.ppm\fP. The only possible conversion |
| 149 |
specifiers are: |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
.TP |
| 154 |
\fBd\fP |
| 155 |
"down": The rank (row) number, starting with 0. |
| 156 |
|
| 157 |
.TP |
| 158 |
\fBa\fP |
| 159 |
"across": The file (column) number, starting with 0. |
| 160 |
|
| 161 |
.TP |
| 162 |
\fB%\fP |
| 163 |
The per cent character (%). |
| 164 |
|
| 165 |
|
| 166 |
.PP |
| 167 |
The number between the % and the conversion specifier is the |
| 168 |
precision and is required. It says how many characters of the file |
| 169 |
name are described by that conversion. The rank or file number is |
| 170 |
filled with leading zeroes as necessary. |
| 171 |
.PP |
| 172 |
So the example \fBtile_%2d_%2a.ppm\fP means to get the name of |
| 173 |
the file that contains the tile at Rank 0, File 5, you: |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
.IP \(bu |
| 178 |
replace the "%2d" with the rank number, as a 2 digit |
| 179 |
decimal number: "00" |
| 180 |
|
| 181 |
.IP \(bu |
| 182 |
Replace the "%2a" with the file number, as a 2 digit |
| 183 |
decimal number: "05" |
| 184 |
|
| 185 |
.PP |
| 186 |
Note that this particular pattern describes file names that \fBpamdice\fP |
| 187 |
produces, except that the precision may be more or less. (See |
| 188 |
the \fB-numberwidth\fP option of \fBpamdice\fP). |
| 189 |
.PP |
| 190 |
Note that a pattern with no %d or no %a effects a replication. |
| 191 |
|
| 192 |
|
| 193 |
.UN options |
| 194 |
.SH OPTIONS |
| 195 |
.PP |
| 196 |
In addition to the options common to all programs based on libnetpbm |
| 197 |
(most notably \fB-quiet\fP, see |
| 198 |
.UR index.html#commonoptions |
| 199 |
Common Options |
| 200 |
.UE |
| 201 |
\&), \fBpamundice\fP recognizes the following |
| 202 |
command line options: |
| 203 |
|
| 204 |
|
| 205 |
.TP |
| 206 |
\fB-across=\fP\fIN\fP |
| 207 |
This is the number of tiles across in the grid, i.e. the number of |
| 208 |
tiles in each rank, or the number of files. |
| 209 |
.sp |
| 210 |
You cannot specify this together with \fB-indexfile\fP. |
| 211 |
.sp |
| 212 |
Default is 1. |
| 213 |
|
| 214 |
.TP |
| 215 |
\fB-down=\fP\fIN\fP |
| 216 |
This is the number of tiles up and down in the grid, i.e. the |
| 217 |
number of tiles in each file, or the number of ranks. |
| 218 |
.sp |
| 219 |
You cannot specify this together with \fB-indexfile\fP. |
| 220 |
.sp |
| 221 |
Default is 1. |
| 222 |
|
| 223 |
.TP |
| 224 |
\fB-hoverlap=\fP\fIpixels\fP |
| 225 |
This is the amount in pixels to overlap the tiles horizontally. |
| 226 |
\fBpamundice\fP clips this much off the right edge of every tile |
| 227 |
before joining it to the adjacent image to the right. The tiles along |
| 228 |
the right edge remain whole. |
| 229 |
.sp |
| 230 |
There must not be any input image narrower than this. |
| 231 |
.sp |
| 232 |
Note that this undoes the effect of the same \fB-hoverlap\fP |
| 233 |
option of \fBpamdice\fP. |
| 234 |
.sp |
| 235 |
Default is zero -- no overlap. |
| 236 |
|
| 237 |
.TP |
| 238 |
\fB-voverlap=\fP\fIpixels\fP |
| 239 |
This is analogous to \fB-hoverlap\fP, but \fBpamundice\fP |
| 240 |
clips the bottom edge of each image before joining it to the one below. |
| 241 |
|
| 242 |
.TP |
| 243 |
\fB-listfile=\fP\fItextfilename\fP |
| 244 |
This option names a file that contains the names of all the input files. |
| 245 |
This is an alternative to specifying a file name pattern as an argument. |
| 246 |
.sp |
| 247 |
The named file contains file names, one per line. Each file contains the |
| 248 |
image for one tile, in row-major order, top to bottom, left to right. So |
| 249 |
the first file is the upper left tile, the second is the one to right of |
| 250 |
that, etc. The number of lines in the file must be equal to the number of |
| 251 |
tiles in the output, the product of the \fB-across\fP and \fB-down\fP |
| 252 |
values. |
| 253 |
.sp |
| 254 |
The file names have no meaning to \fBpamundice\fP. You can list the same |
| 255 |
file multiple times to have identical tiles in the output. |
| 256 |
.sp |
| 257 |
If you create the tile files with \fBpamdice\fP, you can use the |
| 258 |
\fB-listfile\fP option of \fBpamdice\fP to produce a suitable list file |
| 259 |
for reassembling the tiles into the same positions they had in the original |
| 260 |
large image. |
| 261 |
.sp |
| 262 |
You cannot specify this together with \fB-indexfile\fP. |
| 263 |
.sp |
| 264 |
This option was new in Netpbm 10.90 (March 2020). |
| 265 |
|
| 266 |
.TP |
| 267 |
\fB-indexfile=\fP\fIpamfilename\fP |
| 268 |
This option names a file that contains a PAM image that tells which |
| 269 |
tile files to put where in the assembled output. See the |
| 270 |
\fBpamdice\fP \fB-indexfile\fP option for details on its format. |
| 271 |
.sp |
| 272 |
A typical way to generate an index image to use with \fBpamundice\fP is to |
| 273 |
use the \fB-indexfile\fP option of \fBpamdice\fP, and then possibly |
| 274 |
manipulate the resulting index image with other Netpbm tools. |
| 275 |
.sp |
| 276 |
While the sample values in the index image are defined to be rank and file |
| 277 |
positions in some original large image, and so are documented in those terms, |
| 278 |
in practice, \fBpamundice\fP doesn't assign any meaning to the numbers |
| 279 |
-- they are just substitutions for two variables in the input file name |
| 280 |
pattern (given as a program argument). |
| 281 |
.sp |
| 282 |
The maxval of the index image is irrelevant, except that no sample in the |
| 283 |
index image can be greater than it. |
| 284 |
.sp |
| 285 |
The depth of the index file must be at least two (rank and file), but the |
| 286 |
program ignores any additional planes. |
| 287 |
.sp |
| 288 |
The program ignores the tuple type. |
| 289 |
.sp |
| 290 |
If you don't specify this option, the position of a tile in the ouput |
| 291 |
is given directly by the rank and file portions of the tile file name, or if |
| 292 |
you specify \fB-listfile\fP, by order in which the tile files are listed in |
| 293 |
the list file. |
| 294 |
.sp |
| 295 |
You cannot specify this together with \fB-listfile\fP, \fB-down\fP, or |
| 296 |
\fB-across\fP. |
| 297 |
.sp |
| 298 |
This option was new in Netpbm 11.10 (March 2025). |
| 299 |
|
| 300 |
.TP |
| 301 |
\fB-verbose\fP |
| 302 |
This says to print information about the processing to Standard Error. |
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
.UN usage |
| 308 |
.SH Usage |
| 309 |
.PP |
| 310 |
Here is an example of using a list file: |
| 311 |
|
| 312 |
.nf |
| 313 |
\f(CW |
| 314 |
Example usage of -listfile: |
| 315 |
|
| 316 |
pamdice -width=100 -height=100 -outstem=img_part -listfile=listfile \e |
| 317 |
img.ppm |
| 318 |
pamundice -listfile=listfile -across=6 -down=4 > img_copy.ppm |
| 319 |
\fP |
| 320 |
|
| 321 |
.fi |
| 322 |
.PP |
| 323 |
Note that in the above example, you have to know somehow that you got |
| 324 |
6 files and 4 ranks from \fBpamdice\fP and then specify the correct |
| 325 |
\fB-across\fP and \fB-down\fP options on \fBpamundice\fP. A slight error |
| 326 |
ruins the process. A better way is to use \fB-indexfile\fP: |
| 327 |
|
| 328 |
.nf |
| 329 |
\f(CW |
| 330 |
pamdice -width=100 -height=100 -outstem=img_part \e |
| 331 |
-numberwidth=3 -indexfile=index.pam img.pam |
| 332 |
pamundice -indexfile=index.pam img_part_%3d_%3a.pam > img_copy.pam |
| 333 |
\fP |
| 334 |
|
| 335 |
.fi |
| 336 |
|
| 337 |
|
| 338 |
.PP |
| 339 |
Here is an example of flipping a large image. \fBpamflip\fP often |
| 340 |
requires the entire image to be in real memory at once, which can be |
| 341 |
impossible or impractical with a very large image. This method does it in |
| 342 |
smaller pieces so as to require less memory: |
| 343 |
|
| 344 |
.nf |
| 345 |
\f(CW |
| 346 |
Example of -indexfile with pamflip operation: |
| 347 |
|
| 348 |
pamdice -width=2500 -height=2500 -outstem=tile \e |
| 349 |
-numberwidth=3 -indexfile=index.pam hugeImage.ppm |
| 350 |
|
| 351 |
# flip every tile |
| 352 |
for tile in tile_???_???.ppm |
| 353 |
do |
| 354 |
pamflip -r180 $tile > ${tile%.ppm}.flipped.ppm |
| 355 |
done |
| 356 |
|
| 357 |
# flip indexfile - Simply apply the same flip operation |
| 358 |
pamflip -r180 index.pam > index_flipped.pam |
| 359 |
|
| 360 |
pamundice -indexfile=index_flipped.pam tile_%3d_%3a.flipped.ppm \e |
| 361 |
> hugeImage_flipped.ppm |
| 362 |
\fP |
| 363 |
|
| 364 |
.fi |
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
.UN history |
| 369 |
.SH HISTORY |
| 370 |
.PP |
| 371 |
\fBpamundice\fP was new in Netpbm 10.39 (June 2007). Before that, |
| 372 |
\fBpamcat\fP is the best substitute. |
| 373 |
|
| 374 |
|
| 375 |
.UN seealso |
| 376 |
.SH SEE ALSO |
| 377 |
.BR "pamdice" (1)\c |
| 378 |
\&, |
| 379 |
.BR "pamcat" (1)\c |
| 380 |
\&, |
| 381 |
.BR "pnmindex" (1)\c |
| 382 |
\&, |
| 383 |
.BR "pnmtile" (1)\c |
| 384 |
\&, |
| 385 |
.BR "pnmtile" (1)\c |
| 386 |
\&, |
| 387 |
.BR "pnm" (1)\c |
| 388 |
\&, |
| 389 |
.BR "pam" (1)\c |
| 390 |
\& |
| 391 |
.SH DOCUMENT SOURCE |
| 392 |
This manual page was generated by the Netpbm tool 'makeman' from HTML |
| 393 |
source. The master documentation is at |
| 394 |
.IP |
| 395 |
.B http://netpbm.sourceforge.net/doc/pamundice.html |
| 396 |
.PP |