PAMUNDICE(1)
πΈ Pamundice User Manual β part 1 πΈ
okay bestie, gather round π«Ά this is the Pamundice User Manual, and it lives in section 1 of the General Commands Manual. she's giving classic, she's giving utility, and she's literally here to glue your little image tiles back into one big iconique picture. let's go π
π NAME π
pamundice β combine grid of images (tiles) into one. no cap, that's the whole job.
β¨ EXAMPLE β¨
watch her work π
$ 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
and if you want even more examples, go see pamdice β she has the range π
π SYNOPSIS π
pamundice
{ [-across=n]
[-down=n] , -indexfile=pamfilename }
[-hoverlap=pixels]
[-voverlap=pixels]
[-verbose]
{input_filename_pattern, -listfile=textfilename}
a few little quality-of-life notes, bestie:
- you can totally use the minimum unique abbreviation of the options β no need to spell the whole thing out
- 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
slay, flexible queen π
π¦ DESCRIPTION π¦
This program is part of Netpbm(1).
So here's the tea: pamundice reads a whole bunch of Netpbm images as input and combines them as a grid of tiles into a single output image of the same kind, and she sends it to Standard Output. π«Ά
and yes, you can optionally make the pieces overlap if that's the vibe you're going for.
also β the pieces don't have to be distinct. like, you can literally make a single input image show up multiple places in the output grid. repeating your fave? that's called range, periodt. β¨
The images can either be:
- in files whose names indicate where they go in the output (e.g.
myimage_part_03_04could be the image for Row 3, Column 4 β see the input_filename_pattern argument), or - listed in a file, with a
-listfileoption
Now for the rules, and bestie, these ones are NON-negotiable π€
- 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 β wiggle room, we love to see it π
pamdice is the inverse of pamundice. you can use pamundice to reassemble an image sliced up by pamdice. you can also use pamdice to recreate the tiles of an image created by pamundice, but to do that, 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.
One use for this is to process an image in pieces when the whole image is too large to process. like, imagine you have an image so huge that an image editor can't read it all into memory or processes it very slowly π. you can split it into smaller pieces with pamdice, edit one at a time, and then reassemble them with pamundice. girlboss behavior tbh.
Of course, you can also use pamundice 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 pamundice to assemble them into a board. βοΈ iconic.
An alternative to join images in a single direction (i.e. a single rank or a single file) is pamcat. pamcat 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. different girl, similar energy π
To join piecewise photographs, use pnmstitch instead of pamundice, because it figures out where the pieces overlap, even if they don't overlap exactly vertically or horizontally. she's the smart one fr fr.
To create an image of the same tile repeated in a grid, that's pnmtile. πΈ
pnmindex does a similar thing to pamundice: it combines a bunch of small images in a grid into a big one. BUT β her purpose is to produce an index image of the input images. so she leaves space between them and has labels for them, for example. different job, different fit, iykyk π
π ARGUMENTS π
Unless you use a -listfile option, there is one non-option argument, and it is mandatory: input_filename_pattern. this tells pamundice what files contain the input tiles.
pamundice reads the input images from files which are named with a pattern that indicates their positions in the combined image. for example, tile_00_05.ppm could be the 6th tile over in the 1st rank, while tile_04_01 is the 2nd tile over in the 5th rank.
(But see -indexfile, 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 pamundice in any arbitrary position in its output. plot twist π³)
You cannot supply any of the data on Standard Input, and the files must be the kind that pamundice 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. π
input_filename_pattern is a printf-style pattern. (See the standard C library printf subroutine.) for the example above, it would be tile_%2d_%2a.ppm. the only possible conversion specifiers are:
dβ "down": The rank (row) number, starting with 0.aβ "across": The file (column) number, starting with 0.%β The per cent character (%).
The number between the % and the conversion specifier is the precision and it 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.
So the example tile_%2d_%2a.ppm means to get the name of the file that contains the tile at Rank 0, File 5, you:
- replace the
"%2d"with the rank number, as a 2 digit decimal number:"00" - Replace the
"%2a"with the file number, as a 2 digit decimal number:"05"
Note that this particular pattern describes file names that pamdice produces, except that the precision may be more or less. (See the -numberwidth option of pamdice.)
Note that a pattern with no %d or no %a effects a replication. π
π OPTIONS π
In addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pamundice recognizes the following command line options:
-across=Nβ This is the number of tiles across in the grid, i.e. the number of tiles in each rank, or the number of files.
You cannot specify this together with -indexfile.
Default is 1.
-down=Nβ 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.
You cannot specify this together with -indexfile.
Default is 1.
-hoverlap=pixelsβ This is the amount in pixels to overlap the tiles horizontally.pamundiceclips 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.
There must not be any input image narrower than this. β οΈ
Note that this undoes the effect of the same -hoverlap option of pamdice.
Default is zero β no overlap.
-voverlap=pixelsβ This is analogous to-hoverlap, butpamundiceclips the bottom edge of each image before joining it to the one below. π«Ά-listfile=textfilenameβ 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.
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 -across and -down values.
The file names have no meaning to pamundice. you can list the same file multiple times to have identical tiles in the output. π
If you create the tile files with pamdice, you can use the -listfile option of pamdice to produce a suitable list file for reassembling the tiles into the same positions they had in the original large image.
You cannot specify this together with -indexfile.
This option was new in Netpbm 10.90 (March 2020).
-indexfile=pamfilenameβ This option names a file that contains a PAM image that tells which tile files to put where in the assembled output. see thepamdice -indexfileoption for details on its format.
A typical way to generate an index image to use with pamundice is to use the -indexfile option of pamdice, and then possibly manipulate the resulting index image with other Netpbm tools. π οΈ
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, pamundice 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).
The maxval of the index image is irrelevant, except that no sample in the index image can be greater than it.
The depth of the index file must be at least two (rank and file), but the program ignores any additional planes.
The program ignores the tuple type.
If you don't specify this option, the position of a tile in the output is given directly by the rank and file portions of the tile file name, or if you specify -listfile, by order in which the tile files are listed in the list file.
You cannot specify this together with -listfile, -down, or -across.
This option was new in Netpbm 11.10 (March 2025).
-verboseβ This says to print information about the processing to Standard Error. π£οΈ
β¨ Usage β¨
Okay bestie, real talk β this is where it all comes together π. Here's what it looks like when you actually use a list file:
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
Now listen, lowkey important π«Ά: in that example you have to know somehow that pamdice gave you 6 files across and 4 ranks down, and then you have to feed the exact right -across and -down values into pamundice yourself. And ngl, one tiny slip-up and the whole thing is ruined π. Not cute at all.
A way better way is to use -indexfile and let the files do the talking:
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
πΈ Flipping a huge image, the memory-friendly way πΈ
Here's an example of flipping a big ol' image. The thing is, pamflip often needs the entire image sitting in real memory all at once π, and for a very large image that's either impossible or just straight up impractical. So this method chops it into smaller pieces so it needs way less memory. It's giving big-brain energy tbh β¨.
Example of-indexfilewithpamflipoperation:
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
See how the indexfile just gets the same operation applied to it? Iconic. Chef's kiss π.
π HISTORY π
pamundice was new in Netpbm 10.39 (June 2007). No cap π. And before that existed? Bestie, pamcat is the best substitute β it had your back.
π SEE ALSO π
pamdice(1)pamcat(1)pnmindex(1)pnmtile(1)pnmtile(1)pnm(1)pam(1)
π DOCUMENT SOURCE π
This manual page was generated by the Netpbm tool makeman from HTML source. The master documentation lives at:
http://netpbm.sourceforge.net/doc/pamundice.html
And that's the whole page, bestie!! π Generated by the Netpbm tool makeman (yes, it really does all this), this version of the manual is from netpbm documentation, dated 02 January 2026, and it's the Pamundice User Manual(1). Go forth and stitch your tiles together, you absolute legend π¦β¨π
π¦ where this page comes from
- ubuntu stonking: netpbm 2:11.13.03+ds-2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms