{
    "mode": "man",
    "parameter": "pnmshear",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/pnmshear/1/json",
    "generated": "2026-08-07T14:11:04Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "pnmshear - shear a PNM image by a specified angle\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "pnmshear",
                    "content": "[-noantialias] [-background=color] angle [pnmfile]\n\nAll  options can be abbreviated to their shortest unique prefix.  You may use two hyphens in‐\nstead of one to designate an option.  You may use either white space or equals signs  between\nan option name and its value.\n\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "This program is part of Netpbm(1).\n\npnmshear  reads  a  PNM image as input and shears it by the specified angle and produce a PNM\nimage as output.  If the input file is in color, the output will be too, otherwise it will be\ngrayscale.  The angle is in degrees (floating point), and measures this:\n\n+-------+  +-------+\n|       |  |\\       \\\n|  OLD  |  | \\  NEW  \\\n|       |  |an\\       \\\n+-------+  |gle+-------+\n\n\nIf the angle is negative, it shears the other way:\n+-------+  |-an+-------+\n|       |  |gl/       /\n|  OLD  |  |e/  NEW  /\n|       |  |/       /\n+-------+  +-------+\n\n\nThe angle should not get too close to 90 or -90, or the resulting image will be  unreasonably\nwide.  In fact, if it gets too close, the width will be so large that pnmshear cannot do com‐\nputations in the word sizes it uses, and the program detects this and fails.\n\npnmshear  does  the  shearing by looping over the source pixels and distributing fractions to\neach of the destination pixels.  This has an \"anti-aliasing\" effect - it avoids jagged  edges\nand similar artifacts.  However, it also means that the original colors in the image are mod‐\nified  and  there are typically more of them than you started with.  If you need to keep pre‐\ncisely the same set of colors, see the -noantialias option.  If the  expanded  palette  is  a\nproblem, you can run the result through pnmquant.\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "In  addition  to  the options common to all programs based on libnetpbm (most notably -quiet,\nsee \u001b]8;;index.html#commonoptions\u001b\\ Common Options\u001b]8;;\u001b\\ ), pnmshear recognizes the following command line options:\n\n\n",
            "subsections": [
                {
                    "name": "-background=_",
                    "content": "This determines the color of the background on which the sheared image sits.\n\nSpecify the color (color) as described  for  the  \u001b]8;;libnetpbmimage.html#colorname\u001b\\argument of the pnmparsecolor() li‐\nbrary routine\u001b]8;;\u001b\\ .\n\nBy  default,  if you don't specify this option, pnmshear selects what appears to it to\nbe the background color of the original image.  It determines this color  rather  sim‐\nplistically, by taking an average of the colors of the two top corners of the image.\n\nThis option was new in Netpbm 10.37 (December 2006).  Before that, pnmshear always be‐\nhaved as is the default now.\n\n"
                },
                {
                    "name": "-noantialias",
                    "content": "This  option forces pnmshear to simply move pixels around instead of synthesizing out‐\nput pixels from multiple input pixels.  The latter could cause the output  to  contain\ncolors  that are not in the input, which may not be desirable.  It also probably makes\nthe output contain a large number of colors.  If you need a small  number  of  colors,\nbut  it  doesn't  matter if they are the exact ones from the input, consider using pn‐\nmquant on the output instead of using -noantialias.\n\nNote that to ensure the output does not contain colors that are not in the input,  you\nalso must consider the background color.  See the -background option.\n\n\n\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "pnmrotate(1), pamflip(1), pamhomography(1), pnmquant(1), pamrestack(1), pnm(1)\n\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Copyright (C) 1989, 1991 by Jef Poskanzer.\n",
            "subsections": []
        },
        "DOCUMENT SOURCE": {
            "content": "This  manual  page  was  generated by the Netpbm tool 'makeman' from HTML source.  The master\ndocumentation is at\n\nhttp://netpbm.sourceforge.net/doc/pnmshear.html\n\nnetpbm documentation                        22 March 2020                    Pnmshear User Manual(1)",
            "subsections": []
        }
    },
    "summary": "pnmshear - shear a PNM image by a specified angle",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This determines the color of the background on which the sheared image sits. Specify the color (color) as described for the \u001b]8;;libnetpbmimage.html#colorname\u001b\\argument of the pnmparsecolor() li‐ brary routine\u001b]8;;\u001b\\ . By default, if you don't specify this option, pnmshear selects what appears to it to be the background color of the original image. It determines this color rather sim‐ plistically, by taking an average of the colors of the two top corners of the image. This option was new in Netpbm 10.37 (December 2006). Before that, pnmshear always be‐ haved as is the default now."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option forces pnmshear to simply move pixels around instead of synthesizing out‐ put pixels from multiple input pixels. The latter could cause the output to contain colors that are not in the input, which may not be desirable. It also probably makes the output contain a large number of colors. If you need a small number of colors, but it doesn't matter if they are the exact ones from the input, consider using pn‐ mquant on the output instead of using -noantialias. Note that to ensure the output does not contain colors that are not in the input, you also must consider the background color. See the -background option."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "pnmrotate",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmrotate/1/json"
        },
        {
            "name": "pamflip",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pamflip/1/json"
        },
        {
            "name": "pamhomography",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pamhomography/1/json"
        },
        {
            "name": "pnmquant",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmquant/1/json"
        },
        {
            "name": "pamrestack",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pamrestack/1/json"
        },
        {
            "name": "pnm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnm/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Shear a PNM image.",
        "examples": [
            {
                "description": "Shear a PNM image by the specified angle",
                "command": "pnmshear {{angle}} {{path/to/input.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Specify the color of the background in the sheared image",
                "command": "pnmshear {{-b|-background}} {{blue}} {{angle}} {{path/to/input.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Do not perform anti-aliasing",
                "command": "pnmshear {{-n|-noantialias}} {{angle}} {{path/to/input.pnm}} > {{path/to/output.pnm}}"
            }
        ]
    }
}