$ pamdice myimage.ppm -outstem=myimage_part -width=10 -height=8 $ pamundice myimage_part_%1d_%1a.ppm -across=10 -down=8 >myimage.ppm $ pamdice myimage.ppm -outstem=myimage_part -height=12 -voverlap=9 $ pamdice myimage.ppm -width=10 -height=8 -listfile=tiles.txt myimage.ppm $ pamundice -across=10 -down=4 -listfile=tiles.txt >myimage.ppm $ pamdice myimage.ppm -width=10 -height=8 -outstem=myimage_part \ -indexfile=tiles.pam myimage.ppm $ pamundice myimage_part_%1d_%1a.ppm -across=10 -down=8 \ -indexfile=tiles.pam >myimage.ppm
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.
This program is part of Netpbm.
pamdice reads a PAM, PBM, PGM, or PPM image as input and splits it horizontally and/or vertically into equal size pieces and writes them into separate files as the same kind of image. You can optionally make the pieces overlap.
See the -outstem option for information on naming of the output files.
The -width and -height options determine the size of the output pieces.
pamundice can rejoin the images. For finer control, you can also use pamcat.
One use for this is to make pieces that take less computer resources than the whole image 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. With pamdice, you can split it into smaller pieces, edit one at a time, and then reassemble them.
Another use for this is to print a large image in small printer-sized pieces that you can glue together. ppmglobe does a similar thing; it lets you glue the pieces together into a sphere.
If you want to cut pieces from an image individually, not in a regular grid, use pamcut.
In addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pamdice recognizes the following command line options:
x and y are filled with leading zeroes so are the same width in every file. Use -numberwidth to specify that width; otherwise, it defaults to the minimum width that works for all the files. For example, if you have 25 slices across and no -numberwidth, x is 2 digits for all the output files. The leftmost slice is numbered "00"; the next one is "01", etc. With -numberwidth=3, x is "000", "001", etc.
It is not valid to specify a width less than is necessary to represent all the slices.
This option was new in Netpbm 11.10 (March 2025).
This option was new in Netpbm 10.23 (July 2004).
This option was new in Netpbm 10.23 (July 2004).
$ pamdice -width=100 -height=100 -outstem=myimage_part -listfile=mylist.txt \
-numberwidth=3 myimage.ppm
on a 200x200 image generates the file mylist.txt containing this:
myimage_part_000_000.ppm myimage_part_000_001.ppm myimage_part_001_000.ppm myimage_part_001_001.ppm
You can use this list file with pamundice -listfile in lieu of an input file name pattern argument, which may save you the trouble of coordinating the patterns used in your invocations of pamdice and pamundice.
This option was new in Netpbm 11.10 (March 2025).
(0,0) (0,1) (0,2) (1,0) (1,1) (1,2)
The depth of the image is 2, the tuple type is "grid_coord" (a tuple type invented for use with pamdice and pamundice), and the maxval is 255 unless the height or width is greater than 256, in which case it is 65535.
This image can be useful as input to pamundice, particularly after doing transformations on it. The prime example of such usage is in flipping a large image. You can dice the image with pamdice, then flip each of the tiles produced (with pamflip), then flip the index image (again with pamflip), then use pamundice with the flipped tiles and the flipped index image to generate a flipped version of the original large image.
This option was new in Netpbm 11.10 (March 2025).
This option was new in Netpbm 11.10 (March 2025).
pamdice was new in Netpbm 9.25 (March 2002).
Before Netpbm 10.29 (August 2005), there was a limit of 100 slices in each direction.