# pnmscale(1) - man - phpman

> **TLDR:** This command has been replaced by `pamscale`.
>
- View documentation for `pamscale`:
  `tldr pamscale`

*Source: tldr-pages*

---

[pnmscale(1)](https://www.chedong.com/phpMan.php/man/pnmscale/1/markdown)                            General Commands Manual                           [pnmscale(1)](https://www.chedong.com/phpMan.php/man/pnmscale/1/markdown)



## NAME
       pnmscale - scale a portable anymap

## SYNOPSIS
       **pnmscale** _scale_factor_ [_pnmfile_]
       **pnmscale** **-reduce** _reduction_factor_ [_pnmfile_]
       **pnmscale**  [{**-xsize=**_cols_  |  **-width=**_cols_  |  **-xscale=**_factor_}]  [{**-ysize=**_rows_  | **-height=**_rows_ |
### -yscale=
       **pnmscale** **-xysize** _cols_ _rows_ [_pnmfile_]
       **pnmscale** **-pixels** _n_ [_pnmfile_]

       Miscellaneous options:
### -verbose -nomix


       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 sep‐
       arate an option name from its value.



## DESCRIPTION
       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.  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.

       If you want PBM output, use **pgmtopbm** to convert **pnmscale**'s output to PBM.  Also consider **pbm**‐‐
       **reduce**.

       You can both enlarge (scale factor > 1) and reduce (scale factor < 1).

       When  you  specify an absolute size or scale factor for both dimensions, **pnmscale** scales each
       dimension independently without consideration of the aspect ratio.

       If you specify one dimension as a pixel size and don't specify the other dimension,  **pnmscale**
       scales the unspecified dimension to preserve the aspect ratio.

       If  you  specify  one dimension as a scale factor and don't specify the other dimension, **pnm**‐‐
       **scale** leaves the unspecified dimension unchanged from the input.

       If you specify the _scale_factor_ parameter instead of dimension options,  that  is  the  scale
       factor for both dimensions.  It is equivalent to **-xscale=**_scale_factor_ **-yscale=**_scale_factor_ .

       Specifying  the  **-reduce** _reduction_factor_ option is equivalent to specifying the _scale_factor_
       parameter, where _scale_factor_ is the reciprocal of _reduction_factor_.

### -xysize
       fits within the box, while preserving its aspect ratio.

### -pixels
       that number of pixels.  If the input image is already no more than that many pixels, **pnmscale**
       just copies it as output; **pnmscale** does not scale up with **-pixels**.

       If you enlarge by a factor of 3 or more, you should probably add a _pnmsmooth_ step; otherwise,
       you can see the original pixels in the resulting image.

       When the scale factor is not an integer (including all cases of scaling down), there are  two
       ways to do the scaling.  Which one **pnmscale** does is controlled by its **-nomix** option.

       By  default,  **pnmscale** mixes the colors of adjacent pixels to produce output pixels that con‐
       tain 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.

       But if you specify **-nomix**, **pnmscale** 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, pix‐
       els 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.

       When the scale factor is an integer (which means you're scaling up), the **-nomix** option has no
       effect  -- output pixels are always just N copies of the input pixels.  In this case, though,
       consider using **pamstretch** instead of **pnmscale** to get the added pixels interpolated instead of
       just copied and thereby get a smoother enlargement.

       **pnmscale**  with  **-nomix**  is  faster  than without, but **pnmenlarge** is faster still.  **pnmenlarge**
       works only on integer enlargements.

       A useful application of **pnmscale** is to blur an image.  Scale it down  (without  **-nomix**  **)**  to
       discard some information, then scale it back up using **pamstretch**.

       Or  scale  it  back  up with **pnmscale** and create a "pixelized" image, which is sort of a com‐
       puter-age version of blurring.



   **PRECISION**
       **pnmscale** 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 re‐
       sults) faster with **pnmscalefixed**, which uses fixed point arithmetic.  **pnmscalefixed** may, how‐
       ever, distort your image a little.  See **pnmscalefixed**'s man page for a complete discussion of
       the difference.


## SEE ALSO
       [**pnmscalefixed**(1)](https://www.chedong.com/phpMan.php/man/pnmscalefixed/1/markdown), [**pamstretch**(1)](https://www.chedong.com/phpMan.php/man/pamstretch/1/markdown), [**pbmreduce**(1)](https://www.chedong.com/phpMan.php/man/pbmreduce/1/markdown), [**pnmenlarge**(1)](https://www.chedong.com/phpMan.php/man/pnmenlarge/1/markdown), [**pnmsmooth**(1)](https://www.chedong.com/phpMan.php/man/pnmsmooth/1/markdown), [**pnmcut**(1)](https://www.chedong.com/phpMan.php/man/pnmcut/1/markdown), [**pnm(5)](https://www.chedong.com/phpMan.php/man/pnm/5/markdown)**


## AUTHOR
       Copyright (C) 1989, 1991 by Jef Poskanzer.



                                          04 November 2000                               [pnmscale(1)](https://www.chedong.com/phpMan.php/man/pnmscale/1/markdown)
