{
    "mode": "man",
    "parameter": "ppmlabel",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/ppmlabel/1/json",
    "generated": "2026-08-05T22:31:32Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "ppmlabel - add text to a PPM image\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "ppmlabel",
                    "content": "[-angle angle]\n\n[-background { transparent | color } ]\n\n[-color color]\n\n[-file filename]\n\n[-size\n\ntextsize]\n\n[-text textstring]\n\n[-x column]\n\n[-y row]\n\n...\n\n[ppmfile]\n\n\n"
                }
            ]
        },
        "EXAMPLE": {
            "content": "ppmlabel -x 50 -y 50 -text hello \\\n-angle -30 -text there \\\ntestimg.ppm\n\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This program is part of Netpbm(1).\n\nppmlabel  uses  the  text drawing facilities of libnetpbm's \"ppmd\" component to add text to a\nPBM image.  You control the location, size, baseline angle, color of the text, and background\ncolor (if any) with command line arguments.  You can specify the text on the command line  or\nsupply it in files.\n\nYou can add any number of separate labels in a single invocation of ppmlabel, limited only by\nany  restrictions  your  environment  has on the number and size of program arguments (e.g. a\nshell's command size limit).\n\nIf you don't specify ppmfile, ppmlabel reads its input PPM image from Standard Input.\n\nThe output image goes to Standard Output.\n\nA more sophisticated way to add a label to an image is to use pbmtext or pbmtextps to  create\nan image of the text, then pamcomp to overlay it onto the base image.\n\nAnother more general program is ppmdraw.  It is slightly harder to use for simple labelling.\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\\ ), ppmlabel recognizes the following command line options:\n\nThe arguments on the ppmlabel command line are not options in the strict sense; they are com‐\nmands which control the placement and appearance of the text being added to the input  image.\nThey are executed left to right, and any number of arguments may appear.\n\nYou can abbreviate any option to its shortest unique prefix.\n\n\n",
            "subsections": [
                {
                    "name": "-angle _",
                    "content": "This  option  sets the angle of the baseline of subsequent text.  angle is an integral\nnumber of degrees, measured counterclockwise from the row axis of the image.\n\n"
                },
                {
                    "name": "-background",
                    "content": "If the argument is transparent, ppmlabel draws the text over the  existing  pixels  in\nthe image.  If you specify a color (see the -color option below for information on how\nto  specify  colors),  ppmlabel  generates  background rectangles enclosing subsequent\ntext, and those rectangles are filled with that color.\n\n"
                },
                {
                    "name": "-color _",
                    "content": "This option sets the color for subsequent text.\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\n-colour is an acceptable alternate spelling.\n\n"
                },
                {
                    "name": "-file _",
                    "content": "This  option  causes  ppmlabel  to read lines of text from the file named filename and\ndraw it on successive lines.\n\n"
                },
                {
                    "name": "-size _",
                    "content": "This option sets the height of the tallest characters above the baseline  to  textsize\npixels.\n\n"
                },
                {
                    "name": "-text _",
                    "content": "This  option causes ppmlabel to draw the specified text string.  It advances the loca‐\ntion for subsequent text down 1.75 times the current textsize.   That  lets  you  draw\nmultiple  lines of text in a reasonable manner without specifying the position of each\nline.\n\nNote that if you invoke ppmlabel via a shell command and  your  text  string  contains\nspaces,  you'll  have to quote it so the shell treats the whole string as a single to‐\nken.  E.g.\n$ ppmlabel -text \"this is my text\" baseimage.ppm >annotatedimage.ppm\n\n\n\n"
                },
                {
                    "name": "-x _",
                    "content": "This option sets the pixel column at which subsequent text  will  be  left  justified.\nDepending  on the shape of the first character, the actual text may begin a few pixels\nto the right of this point.\n\n",
                    "flag": "-x"
                },
                {
                    "name": "-y _",
                    "content": "acters with descenders, such as \"y,\" will extend below this line.\n\n\n\n",
                    "flag": "-y"
                }
            ]
        },
        "LIMITATIONS": {
            "content": "Text strings are restricted to 7 bit ASCII.  The text font used by ppmlabel  doesn't  include\ndefinitions for 8 bit ISO 8859/1 characters.\n\nWhen  drawing  multiple  lines  of text with a non-transparent background, it should probably\nfill the space between the lines with the background color.  This is tricky to get right when\nthe text is rotated to a non-orthogonal angle.\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "ppmmake(1), ppmdraw(1), pbmtext(1), pbmtextps(1), pamcomp(1), ppm(1)\n\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Copyright (C) 1995 by John Walker (kelvin@fourmilab.ch)  WWW  home  page:  \u001b]8;;http://www.fourmilab.ch/\u001b\\http://www.fourmi‐\nlab.ch/\u001b]8;;\u001b\\\n\nPermission  to  use, copy, modify, and distribute this software and its documentation for any\npurpose and without fee is hereby granted, without  any  conditions  or  restrictions.   This\nsoftware is provided ``as is'' without express or implied warranty.\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/ppmlabel.html\n\nnetpbm documentation                        15 April 2006                    Ppmlabel User Manual(1)",
            "subsections": []
        }
    },
    "summary": "ppmlabel - add text to a PPM image",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option sets the angle of the baseline of subsequent text. angle is an integral number of degrees, measured counterclockwise from the row axis of the image."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "If the argument is transparent, ppmlabel draws the text over the existing pixels in the image. If you specify a color (see the -color option below for information on how to specify colors), ppmlabel generates background rectangles enclosing subsequent text, and those rectangles are filled with that color."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option sets the color for subsequent text. Specify the color (color) as described for the \u001b]8;;libnetpbmimage.html#colorname\u001b\\argument of the pnmparsecolor() li‐ brary routine\u001b]8;;\u001b\\ . -colour is an acceptable alternate spelling."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option causes ppmlabel to read lines of text from the file named filename and draw it on successive lines."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option sets the height of the tallest characters above the baseline to textsize pixels."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option causes ppmlabel to draw the specified text string. It advances the loca‐ tion for subsequent text down 1.75 times the current textsize. That lets you draw multiple lines of text in a reasonable manner without specifying the position of each line. Note that if you invoke ppmlabel via a shell command and your text string contains spaces, you'll have to quote it so the shell treats the whole string as a single to‐ ken. E.g. $ ppmlabel -text \"this is my text\" baseimage.ppm >annotatedimage.ppm"
        },
        {
            "flag": "-x",
            "long": null,
            "arg": null,
            "description": "This option sets the pixel column at which subsequent text will be left justified. Depending on the shape of the first character, the actual text may begin a few pixels to the right of this point."
        },
        {
            "flag": "-y",
            "long": null,
            "arg": null,
            "description": "acters with descenders, such as \"y,\" will extend below this line."
        }
    ],
    "examples": [
        "ppmlabel -x 50 -y 50 -text hello \\",
        "-angle -30 -text there \\",
        "testimg.ppm"
    ],
    "see_also": [
        {
            "name": "ppmmake",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmmake/1/json"
        },
        {
            "name": "ppmdraw",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmdraw/1/json"
        },
        {
            "name": "pbmtext",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pbmtext/1/json"
        },
        {
            "name": "pbmtextps",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pbmtextps/1/json"
        },
        {
            "name": "pamcomp",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pamcomp/1/json"
        },
        {
            "name": "ppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppm/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Add text to a PPM image.",
        "examples": [
            {
                "description": "Add text to a PPM image at the specified location",
                "command": "ppmlabel -x {{pos_x}} -y {{pos_y}} {{-t|-text}} {{text}} {{path/to/input_file.ppm}} > {{path/to/output_file.ppm}}"
            },
            {
                "description": "Add multiple texts at different locations",
                "command": "ppmlabel -x {{pos_x1}} -y {{pos_y1}} {{-t|-text}} {{text1}} -x {{pos_x2}} -y {{pos_y2}} {{-t|-text}} {{text2}} {{path/to/input_file.ppm}} > {{path/to/output_file.ppm}}"
            },
            {
                "description": "Specify the line color, the background color, the tilt, and the size of the added text",
                "command": "ppmlabel -x {{pos_x}} -y {{pos_y}} {{-c|-color}} {{line_color}} {{-b|-background}} {{background_color}} {{-a|-angle}} {{tilt}} {{-s|-size}} {{size}} {{-t|-text}} {{text}} {{path/to/input_file.ppm}} > {{path/to/output_file.ppm}}"
            }
        ]
    }
}