{
    "mode": "man",
    "parameter": "pnmpad",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/pnmpad/1/json",
    "generated": "2026-06-03T03:35:06Z",
    "synopsis": "pnmpad [-verbose] [-white|-black]\n[[[-width=width [-halign=ratio]] |\n[-left=leftpad] [-right=rightpad]]]\n[[[-height=height [-valign=ratio]] |\n[-top=toppad] [-bottom=botpad]]]\n[pnmfile]\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 an  equals  sign  be‐\ntween an option name and its value.",
    "sections": {
        "NAME": {
            "content": "pnmpad - add borders to portable anymap\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "pnmpad [-verbose] [-white|-black]\n[[[-width=width [-halign=ratio]] |\n[-left=leftpad] [-right=rightpad]]]\n[[[-height=height [-valign=ratio]] |\n[-top=toppad] [-bottom=botpad]]]\n[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 an  equals  sign  be‐\ntween an option name and its value.\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Reads  a  PNM image as input. Outputs a PNM image that is the input image plus black or white\nborders of the sizes specified.\n\nIf you just need to convert an image to a certain size regardless of the original dimensions,\npnmcut with the -pad option may be a better choice.\n\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-verbose",
                    "content": "Verbose output.\n"
                },
                {
                    "name": "-white",
                    "content": ""
                },
                {
                    "name": "-black (default)",
                    "content": "Set pad color.\n"
                },
                {
                    "name": "-left",
                    "content": ""
                },
                {
                    "name": "-right",
                    "content": ""
                },
                {
                    "name": "-top",
                    "content": ""
                },
                {
                    "name": "-bottom",
                    "content": "Specify amount of padding in pixels.\n"
                },
                {
                    "name": "-width",
                    "content": "Set  desired width of image. Overrides -left and -right if specified. If width is less\nthan the actual image width, it is ignored. Use pnmcut(1) to cut off parts of images.\n"
                },
                {
                    "name": "-height",
                    "content": "Set desired height of image. Overrides -top and -bottom if  specified.  If  height  is\nless  than  the  actual image height, it is ignored. Use pnmcut(1) to cut off parts of\nimages.\n"
                },
                {
                    "name": "-halign",
                    "content": "A real number between 0 and 1. Used in conjunction with -width, sets the alignment ra‐\ntio between left padding and right padding.\n\nUseful values:\n\n0.0    - left aligned;\n\n0.5    - center aligned (default);\n\n1.0    - right aligned.\n"
                },
                {
                    "name": "-valign",
                    "content": "A  real  number  between 0 and 1. Used in conjunction with -height, sets the alignment\nratio between bottom padding and top padding.\n\nUseful values:\n\n0.0    - bottom aligned;\n\n0.5    - center aligned (default);\n\n1.0    - top aligned.\n\n"
                }
            ]
        },
        "HISTORY": {
            "content": "Before February 2002,\npnmpad had a different option syntax which was less expressive and  not  like  conven‐\ntional  Netpbm  programs.  That syntax is still understood by pnmpad for backward com‐\npatibility, but not documented or supported for future use.\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "pbmmake(1), pnmpaste(1), pnmcut(1), pnmcrop(1), pbm(5)\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Copyright (C) 2002 by Martin van Beilen\nCopyright (C) 1990 by Angus Duggan\nCopyright (C) 1989 by Jef Poskanzer.\n\nPermission to use, copy, modify, and distribute this software and its documentation  for  any\npurpose and without fee is hereby granted, provided that the above copyright notice appear in\nall copies and that both that copyright notice and this permission notice appear in  support‐\ning documentation.  This software is provided \"as is\" without express or implied warranty.\n\n\n\n26 January 2002                                 pnmpad(1)",
            "subsections": []
        }
    },
    "summary": "pnmpad - add borders to portable anymap",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Verbose output."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Set pad color."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specify amount of padding in pixels."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Set desired width of image. Overrides -left and -right if specified. If width is less than the actual image width, it is ignored. Use pnmcut(1) to cut off parts of images."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Set desired height of image. Overrides -top and -bottom if specified. If height is less than the actual image height, it is ignored. Use pnmcut(1) to cut off parts of images."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "A real number between 0 and 1. Used in conjunction with -width, sets the alignment ra‐ tio between left padding and right padding. Useful values: 0.0 - left aligned; 0.5 - center aligned (default); 1.0 - right aligned."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "A real number between 0 and 1. Used in conjunction with -height, sets the alignment ratio between bottom padding and top padding. Useful values: 0.0 - bottom aligned; 0.5 - center aligned (default); 1.0 - top aligned."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "pbmmake",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pbmmake/1/json"
        },
        {
            "name": "pnmpaste",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmpaste/1/json"
        },
        {
            "name": "pnmcut",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmcut/1/json"
        },
        {
            "name": "pnmcrop",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmcrop/1/json"
        },
        {
            "name": "pbm",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/pbm/5/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Add borders to a PNM image.",
        "examples": [
            {
                "description": "Add borders of the specified sizes to the image",
                "command": "pnmpad {{-l|-left}} {{100}} {{-ri|-right}} {{150}} {{-t|-top}} {{123}} {{-bo|-bottom}} {{456}} {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Pad the image to the specified size",
                "command": "pnmpad {{-wi|-width}} {{1000}} {{-he|-height}} {{500}} {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Pad the width of the image to the specified size, controlling the ratio between right and left padding",
                "command": "pnmpad {{-wi|-width}} {{1000}} {{-ha|-halign}} {{0.7}} {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Pad the width of the image using the specified color",
                "command": "pnmpad {{-wi|-width}} {{1000}} {{-c|-color}} {{red}} {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            }
        ]
    }
}