Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE>Pnmpad User Manual</TITLE></HEAD>
<BODY>
<H1>pnmpad</H1>
Updated: 1 July 2015
<BR>
<A HREF="#index">Table Of Contents</A>

<H2>NAME</H2>

pnmpad - add borders to a PNM image

<H2 id="synopsis">SYNOPSIS</H2>

<B>pnmpad </B>
[<B>-verbose</B>]
[<B>-white</B>|<B>-black</B>]
<BR>
[<B>-width=</B><I>pixels</I>]
[<B>-halign=</B><I>ratio</I>]
[<B>-mwidth=</B><I>pixels</I>]
<BR>
[<B>-left=</B><I>pixels</I>]
[<B>-right=</B><I>pixels</I>]
<BR>
[<B>-height=</B><I>pixels</I>]
[<B>-valign=</B><I>ratio</I>]
[<B>-mheight=</B><I>pixels</I>]
<BR>
[<B>-top=</B><I>pixels</I>]
[<B>-bottom=</B><I>pixels</I>]
<BR>
[<I>pnmfile</I>]


<H2 id="description">DESCRIPTION</H2>

<p>This program is part of <a href="index.html">Netpbm</a>.

<P><b>pnmpad</b> reads a PNM image as input and outputs a PNM image
that is the input image plus black or white borders of the sizes
specified.

<P>If you just need to convert an image to a certain size regardless
of the original dimensions, <B>pamcut</B> with the <B>-pad</B> option
may be a better choice.

<p><b>pnmmargin</b> does essentially the same thing, but allows you to
add borders of any color and requires all four borders to be the same
size.


<H2 id="options">OPTIONS</H2>

<P>All options can be abbreviated to their shortest unique prefix.  You
may use two hyphens instead of one to designate an option.  You may
use either white space or an equals sign between an option name and
its value.

<DL>
<DT><B>-verbose</B>

<DD>
Verbose output.

<dt><B>-white</B>
<dt><B>-black</B>

<dd>Set pad color.  Default is <b>-black</b>.


<dt><B>-left=</B><I>pixels</I>
<dt><B>-right=</B><I>pixels</I>
<dt><B>-width=</B><I>width</I>
<dt><B>-halign=</B><I>ratio</I>
<dt><B>-mwidth=</B><I>pixels</I>

<dd>Specify amount of left and right padding in pixels.

<p><b>-left</b> and <b>-right</b> directly specify the amount of
padding added to the left and right sides, respectively, of the image.

<p>Alternatively, you can specify <b>-width</b> and just one of
<b>-left</b> and <b>-right</b> and <b>pnmpad</b> calculates the required
padding on the other side based on the width of the input image.  If
the <b>-width</b> value is less than the width of the image plus the
specified padding, the <b>-width</b> values is ignored.

<p>If you specify all three of <b>-width</b>, <b>-left</b>, and
<b>-right</b>, you must ensure that the <b>-left</b> and <b>-right</b>
padding are sufficient to make the image at least as wide as
<b>-width</b> specifies.  Otherwise, <b>pnmpad</b> fails.

<p>When you specify <b>-width</b> without <b>-left</b> or
<b>-right</b>, and <b>-width</b> is larger than the input image,
<b>pnmpad</b> chooses left and right padding amounts in a certain
ratio.  That ratio defaults to half, but you can set it to anything
(from 0 to 1) with the <b>-halign</b> option.  If the input image is
already at least as wide as <b>-width</b> specifies, <b>pnmpad</b>
adds no padding.

<p>Common values for <b>-halign</b> are:
<DL COMPACT>
<DT><B>0.0</B> <DD>left aligned

<DT><B>0.5</B> <DD>center aligned (default)

<DT><B>1.0</B> <DD>right aligned
</DL>

<p><b>-mwidth=</b><i>pixels</i> says to pad to a multiple of
<i>pixels</i> pixels.  E.g. if <i>pixels</i> is 10, the output image width
will be a multiple of 10 pixels.  <b>pnmpad</b> adds to whatever padding the
other options say to do to get to this multiple.  It divides that padding
between the left and right sides of the image to maintain the ratio the other
options produce.  E.g. if you say <b>-left=10 -right=10 -mwidth=50</b> with a
100-pixel image, you end up with a 150-pixel image with the extra padding
split evenly between left and right for a total of 25 pixels of padding
on the left and 25 on the right.

<p>Before Netpbm 10.23 (July 2004), <b>pnmpad</b> did not allow the
<b>-left</b> or <b>-right</b> option together with <b>-width</b>.

<p>Before Netpbm 10.72 (September 2015), there is no <b>-mwidth</b>.

<dt><B>-top=</B><I>pixels</I>
<dt><B>-bottom=</B><I>pixels</I>
<dt><B>-height=</B><I>height</I>
<dt><B>-valign=</B><I>ratio</I>
<dt><B>-mheight=</B><I>pixels</I>

<dd>
These options determine the vertical padding.  They are analogous
to the horizontal padding options above.

</dl>


<H2 id="history">HISTORY</H2>

<p>Before February 2002, <B>pnmpad</B> had a different option syntax
which was less expressive and not like conventional Netpbm programs.
That syntax is still understood by <B>pnmpad</B> for backward
compatibility, but not documented or supported for future use.


<H2 id="seealso">SEE ALSO</H2>

<B><A HREF="pbmmake.html">pbmmake</A></B>,
<B><A HREF="pnmpaste.html">pnmpaste</A></B>,
<B><A HREF="pamcut.html">pamcut</A></B>,
<B><A HREF="pnmcrop.html">pnmcrop</A></B>,
<B><A HREF="pamcomp.html">pamcomp</A></B>,
<B><A HREF="pnmmargin.html">pnmmargin</A></B>,
<B><A HREF="pbm.html">pbm</A></B>


<H2 id="author">AUTHOR</H2>

<p>Copyright (C) 2002 by Martin van Beilen

<p>Copyright (C) 1990 by Angus Duggan

<p>Copyright (C) 1989 by Jef Poskanzer.

<P>Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation.  This software is provided "as is"
without express or implied warranty.

<HR>
<H2 id="index">Table Of Contents</H2>
<UL>
<LI><A HREF="#synopsis">SYNOPSIS</A>
<LI><A HREF="#description">DESCRIPTION</A>
<LI><A HREF="#options">OPTIONS</A>
<LI><A HREF="#history">HISTORY</A>
<LI><A HREF="#seealso">SEE ALSO</A>
<LI><A HREF="#author">AUTHOR</A>
</UL>
</BODY>
</HTML>