310 lines
6.7 KiB
HTML
310 lines
6.7 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of pnmscale</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>pnmscale</H1>
|
|
Section: User Commands (1)<BR>Updated: 04 November 2000<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="ixAAB"></A>
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
pnmscale - scale a portable anymap
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>pnmscale</B>
|
|
|
|
<I>scale_factor</I>
|
|
|
|
[<I>pnmfile</I>]
|
|
|
|
<BR>
|
|
|
|
<B>pnmscale -reduce</B>
|
|
|
|
<I>reduction_factor</I>
|
|
|
|
[<I>pnmfile</I>]
|
|
|
|
<BR>
|
|
|
|
<B>pnmscale</B>
|
|
|
|
[{<B>-xsize=</B><I>cols</I> | <B>-width=</B><I>cols</I> | <B>-xscale=</B><I>factor</I>}]
|
|
|
|
[{<B>-ysize=</B><I>rows</I> | <B>-height=</B><I>rows</I> | <B>-yscale=</B><I>factor</I>}]
|
|
|
|
[<I>pnmfile</I>]
|
|
|
|
<BR>
|
|
|
|
<B>pnmscale -xysize</B>
|
|
|
|
<I>cols rows</I>
|
|
|
|
[<I>pnmfile</I>]
|
|
|
|
<BR>
|
|
|
|
<B>pnmscale -pixels</B>
|
|
|
|
<I>n</I>
|
|
|
|
[<I>pnmfile</I>]
|
|
|
|
<P>
|
|
Miscellaneous options:
|
|
<BR>
|
|
|
|
<B>-verbose -nomix</B>
|
|
|
|
<P>
|
|
<P>
|
|
Minimum unique abbreviation of option is acceptable. You may use double
|
|
hypens instead of single hyphen to denote options. You may use white
|
|
space in place of the equals sign to separate an option name from its value.
|
|
<P>
|
|
<P>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
Reads a PBM, PGM, or PPM image as input,
|
|
scales it by the specified factor or factors and produces a PGM or
|
|
PPM image as output.
|
|
<A NAME="ixAAC"></A>
|
|
<A NAME="ixAAD"></A>
|
|
If the input file is in color (PPM), the output will be too,
|
|
otherwise it will be grayscale (PGM). This is true even if the input is
|
|
a black and white bitmap (PBM), because the process of scaling can
|
|
turn a combination of black and white pixels into a gray pixel.
|
|
<P>
|
|
If you want PBM output, use
|
|
<B>pgmtopbm</B>
|
|
|
|
to convert
|
|
<B>pnmscale</B>'s
|
|
|
|
output to PBM. Also consider
|
|
<B>pbmreduce</B>.
|
|
|
|
<P>
|
|
You can both enlarge (scale factor > 1) and reduce (scale factor < 1).
|
|
<P>
|
|
When you specify an absolute size or scale factor for both dimensions,
|
|
<B>pnmscale</B>
|
|
|
|
scales each dimension independently without consideration of the aspect
|
|
ratio.
|
|
<P>
|
|
If you specify one dimension as a pixel size and don't specify the other
|
|
dimension,
|
|
<B>pnmscale</B>
|
|
|
|
scales the unspecified dimension to preserve the aspect ratio.
|
|
<P>
|
|
If you specify one dimension as a scale factor and don't specify the other
|
|
dimension,
|
|
<B>pnmscale</B>
|
|
|
|
leaves the unspecified dimension unchanged from the input.
|
|
<P>
|
|
If you specify the
|
|
<I>scale_factor</I>
|
|
|
|
parameter instead of dimension options, that is the scale factor for
|
|
both dimensions. It is equivalent to
|
|
<B>-xscale=</B><I>scale_factor</I><B> -yscale=</B><I>scale_factor</I>
|
|
|
|
.
|
|
|
|
<P>
|
|
Specifying the
|
|
<B>-reduce</B>
|
|
|
|
<I>reduction_factor</I>
|
|
|
|
option is equivalent to specifying the
|
|
<I>scale_factor </I>
|
|
|
|
parameter, where
|
|
<I>scale_factor</I>
|
|
|
|
is the reciprocal of
|
|
<I>reduction_factor</I>.
|
|
|
|
<P>
|
|
<B>-xysize</B>
|
|
|
|
specifies a bounding box.
|
|
<B>pnmscale</B>
|
|
|
|
scales the input image to the largest size that fits within the box,
|
|
while preserving its aspect ratio.
|
|
<P>
|
|
<B>-pixels</B>
|
|
|
|
specifies a maximum total number of output pixels.
|
|
<B>pnmscale</B>
|
|
|
|
scales the image down to that number of pixels. If the input image is
|
|
already no more than that many pixels,
|
|
<B>pnmscale</B>
|
|
|
|
just copies it as output;
|
|
<B>pnmscale</B>
|
|
|
|
does not scale up with
|
|
<B>-pixels</B>.
|
|
|
|
<P>
|
|
If you enlarge by a factor of 3 or more, you should probably add a
|
|
<I>pnmsmooth</I>
|
|
|
|
<A NAME="ixAAE"></A>
|
|
step; otherwise, you can see the original pixels in the resulting image.
|
|
<P>
|
|
When the scale factor is not an integer (including all cases of
|
|
scaling down), there are two ways to do the scaling. Which one
|
|
<B>pnmscale </B>
|
|
|
|
does is controlled by its
|
|
<B>-nomix</B>
|
|
|
|
option.
|
|
<P>
|
|
By default,
|
|
<B>pnmscale</B>
|
|
|
|
mixes the colors of adjacent pixels to produce output pixels that contain
|
|
information from multiple input pixels. This makes the image look more like
|
|
it would if it had infinite resolution. Note that it means the output may
|
|
contain colors that aren't in the input at all.
|
|
<P>
|
|
But if you specify
|
|
<B>-nomix</B>,
|
|
|
|
<B>pnmscale</B>
|
|
|
|
never mixes pixels. Each output pixel is derived from one input
|
|
pixel. If you're scaling up, pixels get duplicated. If you're
|
|
scaling down, pixels get omitted. Note that this means the image is
|
|
rather distorted. If you scale up by 1.5 horizontally, for example,
|
|
the even numbered input pixels are doubled in the output and the
|
|
odd numbered ones are copied singly.
|
|
<P>
|
|
When the scale factor is an integer (which means you're scaling up),
|
|
the
|
|
<B>-nomix</B>
|
|
|
|
option has no effect -- output pixels are always just N copies of the
|
|
input pixels. In this case, though, consider using
|
|
<B>pamstretch</B>
|
|
|
|
instead of
|
|
<B>pnmscale</B>
|
|
|
|
to get the added pixels interpolated instead of just copied and thereby
|
|
get a smoother enlargement.
|
|
<P>
|
|
<B>pnmscale </B>
|
|
|
|
with
|
|
<B>-nomix</B>
|
|
|
|
is faster than without, but
|
|
<B>pnmenlarge</B>
|
|
|
|
is faster still.
|
|
<B>pnmenlarge</B>
|
|
|
|
works only on integer enlargements.
|
|
<P>
|
|
A useful application of
|
|
<B>pnmscale</B>
|
|
|
|
is to blur an image. Scale it down (without
|
|
<B>-nomix )</B>
|
|
|
|
to discard some information, then scale it back up using
|
|
<B>pamstretch</B>.
|
|
|
|
<P>
|
|
Or scale it back up with
|
|
<B>pnmscale</B>
|
|
|
|
and create a "pixelized" image, which is sort of a computer-age version
|
|
of blurring.
|
|
<P>
|
|
<P>
|
|
<A NAME="lbAE"> </A>
|
|
<H3>PRECISION</H3>
|
|
|
|
<P>
|
|
<B>pnmscale </B>
|
|
|
|
uses floating point arithmetic internally. There is a speed cost
|
|
associated with this. For some images, you can get the acceptable
|
|
results (in fact, sometimes identical results) faster with
|
|
<B>pnmscalefixed</B>,
|
|
|
|
which uses fixed point arithmetic.
|
|
<B>pnmscalefixed</B>
|
|
|
|
may, however, distort your image a little. See
|
|
<B>pnmscalefixed</B>'s
|
|
|
|
man page for a complete discussion of the difference.
|
|
<P>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmscalefixed">pnmscalefixed</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pamstretch">pamstretch</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pbmreduce">pbmreduce</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmenlarge">pnmenlarge</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmsmooth">pnmsmooth</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmcut">pnmcut</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+pnm">pnm</A>(5)</B>
|
|
|
|
<P>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
Copyright (C) 1989, 1991 by Jef Poskanzer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="4"><A HREF="#lbAE">PRECISION</A><DD>
|
|
</DL>
|
|
<DT id="5"><A HREF="#lbAF">SEE ALSO</A><DD>
|
|
<DT id="6"><A HREF="#lbAG">AUTHOR</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:24 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|