\
.\" 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 "Pamdice User Manual" 0 "07 February 2025" "netpbm documentation"
.SH NAME
pamdice - slice a Netpbm image into many horizontally and/or vertically
.UN example
.SH EXAMPLE
.nf
\f(CW
$ 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 \e
-indexfile=tiles.pam myimage.ppm
$ pamundice myimage_part_%1d_%1a.ppm -across=10 -down=8 \e
-indexfile=tiles.pam >myimage.ppm
\fP
.fi
.UN synopsis
.SH SYNOPSIS
\fBpamdice\fP
\fB-outstem=\fP\fIfilenamestem\fP
[\fB-width=\fP\fIwidth\fP]
[\fB-height=\fP\fIheight\fP]
[\fB-hoverlap=\fP\fIhoverlap\fP]
[\fB-voverlap=\fP\fIvoverlap\fP]
[\fB-numberwidth=\fP\fIN\fP]
[\fB-listfile=\fP\fItextfilename\fP]
[\fB-indexfile=\fP\fIpamfilename\fP
[\fB-dry-run\fP]
[\fB-verbose\fP]
[\fIfilename\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
\fBpamdice\fP 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.
.PP
See the \fB-outstem\fP option for information on naming of the
output files.
.PP
The \fB-width\fP and \fB-height\fP options determine the size of
the output pieces.
.PP
\fBpamundice\fP can rejoin the images. For finer control, you can
also use \fBpamcat\fP.
.PP
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 \fBpamdice\fP, you can split it into smaller pieces,
edit one at a time, and then reassemble them.
.PP
Another use for this is to print a large image in small printer-sized
pieces that you can glue together. \fBppmglobe\fP does a similar thing;
it lets you glue the pieces together into a sphere.
.PP
If you want to cut pieces from an image individually, not in a regular
grid, use \fBpamcut\fP.
.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
\&), \fBpamdice\fP recognizes the following
command line options:
.TP
\fB-outstem=\fPfilenamestem
This option determines the names of the output files. Each output
file is named
\fIfilenamestem\fP\fB_\fP\fIy\fP\fB_\fP\fIx\fP\fB.\fP\fItype\fP,
where \fIfilenamestem\fP is the value of the \fB-outstem\fP option,
\fIx\fP and \fIy\fP are the horizontal and vertical locations,
respectively, in the input image of the output image, zero being the
leftmost and top, and \fItype\fP is \fB.pbm\fP, \fB.pgm\fP,
\fB.ppm\fP, or \fB.pam\fP, depending on the type of image.
.sp
\fIx\fP and \fIy\fP are filled with leading zeroes so are the same width
in every file. Use \fB-numberwidth\fP 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 \fB-numberwidth\fP, \fIx\fP is 2 digits for
all the output files. The leftmost slice is numbered '00'; the next
one is '01', etc. With \fB-numberwidth=3\fP, \fIx\fP is
\&'000', '001', etc.
.TP
\fB-numberwidth=\fP\fIN\fP
This option determines the width of the numbers in the output file
names. See the \fB-outstem\fP option for details.
.sp
It is not valid to specify a width less than is necessary to represent all
the slices.
.sp
This option was new in Netpbm 11.10 (March 2025).
.TP
\fB-width=\fP\fIwidth\fP
This gives the width in pixels of the output images. The rightmost
pieces are smaller than this if the input image is not a multiple of
\fIwidth\fP pixels wide.
.TP
\fB-height=\fP\fIheight\fP
This gives the height in pixels of the output images. The bottom
pieces are smaller than this if the input image is not a multiple of
\fIheight\fP pixels high.
.TP
\fB-hoverlap=\fP\fIhoverlap\fP
This gives the horizontal overlap in pixels between output images. Each
image in a row will overlap the previous one by \fIhoverlap\fP pixels. By
default, there is no overlap.
.sp
This option was new in Netpbm 10.23 (July 2004).
.TP
\fB-voverlap=\fP\fIvoverlap\fP
This gives the vertical overlap in pixels between output images. Each row
of images will overlap the previous row by \fIvoverlap\fP pixels. By
default, there is no overlap.
.sp
This option was new in Netpbm 10.23 (July 2004).
.TP
\fB-listfile=\fP\fItextfilename\fP
This causes the program to generate a file listing the names of all the
tile files it creates. It is in row-major order. For example,
\f(CW
$ pamdice -width=100 -height=100 -outstem=myimage_part -listfile=mylist.txt \e
-numberwidth=3 myimage.ppm
\fP
on a 200x200 image generates the file \fBmylist.txt\fP containing this:
.nf
myimage_part_000_000.ppm
myimage_part_000_001.ppm
myimage_part_001_000.ppm
myimage_part_001_001.ppm
.fi
.sp
You can use this list file with \fBpamundice -listfile\fP in lieu of an
input file name pattern argument, which may save you the trouble of
coordinating the patterns used in your invocations of \fBpamdice\fP and
\fBpamundice\fP.
.sp
This option was new in Netpbm 11.10 (March 2025).
.TP
\fB-indexfile=\fP\fIpamfilename\fP
This causes the program to generate a file containing a PAM image that
contains rank and file numbers for the tiles. It is simply an image whose
width and height are the number of horizontal and vertical slices,
respectively, in which each tuple is just the row and column number of that
tuple. For example, if \fBpamdice\fP produces 3 slices across and 2 down,
the image looks like this:
.nf
(0,0) (0,1) (0,2)
(1,0) (1,1) (1,2)
.fi
.sp
The depth of the image is 2, the tuple type is 'grid_coord' (a
tuple type invented for use with \fBpamdice\fP and \fBpamundice\fP), and the
maxval is 255 unless the height or width is greater than 256, in which case it
is 65535.
.sp
This image can be useful as input to \fBpamundice\fP, particularly after
doing transformations on it. The prime example of such usage is in flipping a
large image. You can dice the image with \fBpamdice\fP, then flip each of
the tiles produced (with \fBpamflip\fP), then flip the index image (again
with \fBpamflip\fP), then use \fBpamundice\fP with the flipped tiles and
the flipped index image to generate a flipped version of the original large
image.
.sp
This option was new in Netpbm 11.10 (March 2025).
.TP
\fB-dry-run\fP
This makes \fBpamdice\fP skip creating the output tile images. It still
creates the list file (with \fB-listfile\fP) and the index file (with
\fB-indexfile\fP) and checks for most errors.
.sp
This option was new in Netpbm 11.10 (March 2025).
.TP
\fB-verbose\fP
Print information about the processing to Standard Error.
.UN history
.SH HISTORY
.PP
\fBpamdice\fP was new in Netpbm 9.25 (March 2002).
.PP
Before Netpbm 10.29 (August 2005), there was a limit of 100 slices in each
direction.
.UN seealso
.SH SEE ALSO
.BR "pamundice" (1)\c
\&,
.BR "pamcut" (1)\c
\&,
.BR "pamcat" (1)\c
\&,
.BR "pgmslice" (1)\c
\&,
.BR "ppmglobe" (1)\c
\&
.BR "pamflip" (1)\c
\&
.BR "pnm" (5)\c
\&
.BR "pam" (5)\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/pamdice.html
.PP