1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
<html><head><title>Pamundice User Manual</title></head>
<body>
<h1>pamundice</h1>
Updated: 08 February 2025
<br>
<a href="#index">Table Of Contents</a>
<h2>NAME</h2>
pamundice - combine grid of images (tiles) into one
<h2 id="example">EXAMPLE</h2>
<pre>
<kbd>
$ pamdice myimage.ppm -outstem=myimage_part -width=10 -height=8
$ pamundice myimage_part_%1d_%1a.ppm -across=10 -down=8 >myimage.ppm
$ pamundice myimage_part_%2a -across=13 -hoverlap=9
</kbd>
</pre>
<p>See <a href="pamdice.html#example">pamdice</a> for more examples.
<h2 id="synopsis">SYNOPSIS</h2>
<b>pamundice</b>
{
[<b>-across=</b><i>n</i>]
[<b>-down=</b><i>n</i>]
,
<b>-indexfile=pamfilename</b>
}
[<b>-hoverlap=</b><i>pixels</i>]
[<b>-voverlap=</b><i>pixels</i>]
[<b>-verbose</b>]
{<i>input_filename_pattern</i>,
<b>-listfile=</b><i>textfilename</i>}
<p>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.
<h2 id="description">DESCRIPTION</h2>
<p>This program is part of <a href="index.html">Netpbm</a>.
<p><b>pamundice</b> 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.
<p>You can optionally make the pieces overlap.
<p>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 <i>input_filename_pattern</i> argument) or listed in a
file, with a <b>-listfile</b> option.
<p>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.
<p><b>pamdice</b> is the inverse of <b>pamundice</b>. You can use
<b>pamundice</b> to reassemble an image sliced up by <b>pamdice</b>.
You can use <b>pamdice</b> to recreate the tiles of an image created
by <b>pamundice</b>, 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.
<p>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 <b>pamdice</b>, edit one at a time, and
then reassemble them with <b>pamundice</b>.
<p>Of course, you can also use <b>pamundice</b> 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 <b>pamundice</b>
to assemble them into a board.
<p>An alternative to join images in a single direction (i.e. a single rank or
a single file) is <b>pamcat</b>. <b>pamcat</b> 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.
<p>To join piecewise photographs, use <b>pnmstitch</b> instead of
<b>pamundice</b>, because it figures out where the pieces overlap, even if
they don't overlap exactly vertically or horizontally.
<p>To create an image of the same tile repeated in a grid, that's
<b>pnmtile</b>.
<p><b>pnmindex</b> does a similar thing to <b>pamundice</b>: 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.
<h2 id="arguments">ARGUMENTS</h2>
<p>Unless you use a <b>-listfile</b> option, there is one non-option
argument, and it is mandatory: <i>input_filename_pattern</i>. This
tells <b>pamundice</b> what files contain the input tiles.
<p><b>pamundice</b> reads the input images from files which are named
with a pattern that indicates their positions in the combined image.
For example, <b>tile_00_05.ppm</b> could be the 6th tile over in the
1st rank, while <b>tile_04_01</b> is the 2nd tile over in the 5th rank.
<p>(But see <b>-indexfile</b>, 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 <b>pamundice</b> in any arbitrary position in its
output).
<p>You cannot supply any of the data on Standard Input, and the files
must be the kind that <b>pamundice</b> 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).
<p><i>input_filename_pattern</i> is a printf-style pattern. (See the
standard C library <b>printf</b> subroutine). For the example above,
it would be <b>tile_%2d_%2a.ppm</b>. The only possible conversion
specifiers are:
<dl>
<dt><b>d</b>
<dd>"down": The rank (row) number, starting with 0.
<dt><b>a</b>
<dd>"across": The file (column) number, starting with 0.
<dt><b>%</b>
<dd>The per cent character (%).
</dl>
<p>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.
<p>So the example <b>tile_%2d_%2a.ppm</b> means to get the name of
the file that contains the tile at Rank 0, File 5, you:
<ul>
<li>replace the "%2d" with the rank number, as a 2 digit
decimal number: "00"
<li>Replace the "%2a" with the file number, as a 2 digit
decimal number: "05"
</ul>
<p>Note that this pattern describes file names that <b>pamdice</b> produces,
except that the precision may be more or less. (See the <b>-numberwidth</b>
option of <b>pamdice</b>).
<h2 id="options">OPTIONS</h2>
<p>In addition to the options common to all programs based on libnetpbm
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions">
Common Options</a>), <b>pamundice</b> recognizes the following
command line options:
<dl compact>
<dt><b>-across=</b><i>N</i>
<dd>This is the number of tiles across in the grid, i.e. the number of
tiles in each rank, or the number of files.
<p>You cannot specify this together with <b>-indexfile</b>.
<p>Default is 1.
<dt><b>-down=</b><i>N</i>
<dd>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.
<p>You cannot specify this together with <b>-indexfile</b>.
<p>Default is 1.
<dt><b>-hoverlap=</b><i>pixels</i>
<dd>This is the amount in pixels to overlap the tiles horizontally.
<b>pamundice</b> 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.
<p>There must not be any input image narrower than this.
<p>Note that this undoes the effect of the same <b>-hoverlap</b>
option of <b>pamdice</b>.
<p>Default is zero -- no overlap.
<dt><b>-voverlap=</b><i>pixels</i>
<dd>This is analogous to <b>-hoverlap</b>, but <b>pamundice</b>
clips the bottom edge of each image before joining it to the one below.
<dt><b>-listfile=</b><i>textfilename</i>
<dd>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.
<p>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 <b>-across</b> and <b>-down</b>
values.
<p>The file names have no meaning to <b>pamundice</b>. You can list the same
file multiple times to have identical tiles in the output.
<p>If you create the tile files with <b>pamdice</b>, you can use the
<b>-listfile</b> option of <b>pamdice</b> to produce a suitable list file
for reassembling the tiles into the same positions they had in the original
large image.
<p>You cannot specify this together with <b>-indexfile</b>.
<p>This option was new in Netpbm 10.90 (March 2020).
<dt><b>-indexfile=</b><i>pamfilename</i>
<dd>This option names a file that contains a PAM image that tells which
tile files to put where in the assembled output. See the
<b>pamfile</b> <b>-indexfile</b> option for details on its format.
<p>A typical way to generate an index image to use with <b>pamundice</b> is to
use the <b>-indexfile</b> option of <b>pamdice</b>, and then possibly
manipulate the resulting index image with other Netpbm tools.
<p>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, <b>pamundice</b> 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).
<p>The maxval of the index image is irrelevant, except that no sample in the
index image can be greater than it.
<p>The depth of the index file must be at least two (rank and file), but the
program ignores any additional planes.
<p>The program ignores the tuple type.
<p>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 <b>-listfile</b>, by order in which the tile files are listed in
the list file.
<p>You cannot specify this together with <b>-listfile</b>, <b>-down</b>, or
<b>-across</b>.
<p>This option was new in Netpbm 11.10 (March 2025).
<dt><b>-verbose</b>
<dd>This says to print information about the processing to Standard Error.
</dl>
<h2 id="usage">Usage</h2>
<p>Here is an example of using a list file:
<pre>
<code>
Example usage of -listfile:
pamdice -width=100 -height=100 -outstem=img_part -listfile=listfile \
img.ppm
pamundice -listfile=listfile -across=6 -down=4 > img_copy.ppm
</code>
</pre>
<p>Note that in the above example, you have to know somehow that you got
6 files and 4 ranks from <b>pamdice</b> and then specify the correct
<b>-across</b> and <b>-down</b> options on <b>pamundice</b>. A slight error
ruins the process. A better way is to use <b>-indexfile</b>:
<pre>
<code>
pamdice -width=100 -height=100 -outstem=img_part \
-numberwidth=3 -indexfile=index.pam img.pam
pamundice -indexfile=index.pam img_part_%3d_%3a.pam > img_copy.pam
</code>
</pre>
<P>Here is an example of flipping a large image. <b>pamflip</b> 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:
<pre>
<code>
Example of -indexfile with pamflip operation:
pamdice -width=2500 -height=2500 -outstem=tile \
-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 \
> hugeImage_flipped.ppm
</code>
</pre>
<h2 id="history">HISTORY</h2>
<p><b>pamundice</b> was new in Netpbm 10.39 (June 2007). Before that,
<b>pamcat</b> is the best substitute.
<h2 id="seealso">SEE ALSO</h2>
<b><a href="pamdice.html">pamdice</a></b>,
<b><a href="pamcat.html">pamcat</a></b>,
<b><a href="pnmindex.html">pnmindex</a></b>,
<b><a href="pnmtile.html">pnmtile</a></b>,
<b><a href="pnmstitch.html">pnmtile</a></b>,
<b><a href="pnm.html">pnm</a></b>,
<b><a href="pam.html">pam</a></b>
<hr>
<h2 id="index">Table Of Contents</h2>
<ul>
<li><a href="#example">EXAMPLE</a>
<li><a href="#synopsis">SYNOPSIS</a>
<li><a href="#description">DESCRIPTION</a>
<li><a href="#arguments">ARGUMENTS</a>
<li><a href="#options">OPTIONS</a>
<li><a href="#usage">USAGE</a>
<li><a href="#history">HISTORY</a>
<li><a href="#seealso">SEE ALSO</a>
</ul>
</body>
</html>
|