PBMTEXTPS(1)
π PBMTEXTPS(1) β Pbmtextps User Manual π
okay bestie, sit down, get comfy, because we're about to render text into a PBM image with a Postscript interpreter and it's gonna be so cute. this is pbmtextps, part of the General Commands Manual bless π«Ά
β¨ NAME β¨
pbmtextps β render text into a PBM image using a postscript interpreter π
πΈ SYNOPSIS πΈ
pbmtextps [-font fontname] [-fontsize float] [-resolution n]
[-leftmargin=n] [-rightmargin=n] [-topmargin=n] [-bottommargin=n]
[-ascent=n] [-descent=n] [-pad] [-crop] [-stroke n] [-asciihex]
[-ascii85] [-verbose] [-dump-ps] text [text ...]
π¦ DESCRIPTION π¦
so this program is one of the Netpbm(1) girlies, she's part of the family π
pbmtextps takes a single line of text off the command line and renders it into a PBM image. that's it, that's the vibe. the image is of one single line of text β and here's the thing, newline characters in the input have no effect at all. none. zero. they're just out here existing for no reason π
also you should clock pbmtext for a more sophisticated generator of text, but it uses less common font formats. pbmtext can generate multiple lines of text though, which is lowkey iconic of it. β¨
and a lil note for the historians: the -plain common option has no effect before Netpbm 10.42 (March 2008). the output is always raw PBM. periodt.
π Margins π
by default, the image is cropped at the top and the right. it is not cropped at the left or bottom, so that the text begins at the same position relative to the origin. the size of the default left and bottom margins is explained below, don't worry bestie I got you π
you can set whatever margin you want with the options -leftmargin, -rightmargin, -topmargin and -bottommargin. the specified amount of white space gets added to the far edge of the type, so like β if you specify 10 points for -topmargin, you will get 10 points of white space above the highest character on the line. cute right? specify 0 to crop a side. βοΈ
-ascent adds white space to the top to reach a specified distance above the text baseline, and -descent adds white space to the bottom to reach a specified distance below the text baseline. yes to the bottom. it's giving vertical realness π«Ά
-ascent and -descent are more useful than -topmargin and -bottomargin when you render two pieces of text (in separate invocations of pbmtextps) that you will concatenate horizontally. with -ascent and -descent, as long as you specify a value greater than the height or detph of every character in the font, the two images will be the same height with the text baseline in the same place. with -topmargin and -bottommargin, that may not be the case. π
example:
$ pbmtextps -font=Times-Roman -descent=20 \
'The soup is called' > a1.pbm
$ pbmtextps -font=Itallic -descent=20 'Goulash.' > a2.pbm
$ pamcat -leftright -jbottom a1.pbm a2.pbm > out.pbm
if you're using -descent to line up the segments of text you are concatenating horizontally with pamcat, use the -jbottom (justify to bottom) option on pamcat as in the example above. and if you use -ascent, use -jtop instead. match your energy to your option bestie π
similarly, if you render two lines of text (in separate invocations of pbmtextps) that you will concatenate vertically, -ascent and -descent with sufficiently large values will ensure your baselines are uniformly spaced. consistent spacing? we love to see it. β
if you have -ascent, there is probably no point in specifying -topmargin too, but if you do, the effect is cumulative. same energy for -descent and -bottommargin.
-pad pads the image on the top and bottom to where the highest and lowest characters in the font would reach, even if you don't have those characters in your text. this is useful if you will generate multiple images of text (with multiple invocations of pbmtextps) and concatenate them vertically to create a multiline text image. -pad makes sure the lines in this image are equally spaced. it's the great equaliser honestly π
example:
$ pbmtextps 'cat' | pamfile
$ pbmtextps 'Catty' | pamfile
the commands above, with no -pad, show that the 'Catty' image is higher because capital C reaches high and 'y' reaches low. the letters are doing the most, as usual π
$ pbmtextps -pad 'cat' | pamfile
$ pbmtextps -pad 'Catty' | pamfile
the commands above, with -pad, show that both images are the same height. slay. β¨
if you specify -pad with -ascent or -descent, the larger value is effective.
-crop makes the program crop all sides to the far edge of the type. it is the same as -leftmargin=0 -rightmargin=0 -topmargin=0 -bottommargin=0. simple as that π
β οΈ you cannot specify any other margin-affecting options with -crop. it's an exclusive queen, pick a lane bestie.
the default top margin, when you specify neither -ascent, -topmargin, nor -pad, is as if you specified topmargin=0.
the default bottom margin, when you specify neither -descent, -bottommargin, nor -pad, is as if you specified -descent=1.5*fontsize.
the default left margin, when you do not specify -leftmargin, is as if you specified -leftmargin=0.5*fontsize.
the default right margin, when you do not specify -rightmargin, is as if you specified -rightmargin=0.
π Input Text π
the simplest way to specify the text to render is just to specify it, in ASCII, as the sole argument of the command. for example:
$ pbmtextps 'hello world'
but you can also spread it across multiple arguments. pbmtextps concatenates them right to left with a single space in between:
$ pbmtextps hello world
with an -asciihex option, you can specify the text in Postscript's ASCII-HEX code:
$ pbmtextps -asciihex 68656c6c6f20776f726c64
you can optionally include the ASCII-HEX text delimiters that would appear around the text in a Postscript program:
$ pbmtextps -asciihex '<68656c6c6f20776f726c64>'
β οΈ note that the<>delimiters have special meaning to command shells, so if you are invokingpbmtextpsvia a command shell, be sure to quote them, as is done in this example. don't get caught out π
with -asciihex, you can include white space anywhere in the coded text; it has no effect. and you can spread the argument across multiple arguments as for plain ASCII input:
$ pbmtextps -asciihex '<' 68656c6c6f 20 776f726c64 '>'
but note that while Postscript allows an ASCII NUL character as white space, there is no way to pass an argument including a NUL character to pbmtextps. tragic, honestly π
with an -ascii85 option, you can specify the text in Postscript's ASCII-85 code. this is analogous to -asciihex. the Postscript delimiters for an ASCII-85 text string are <~ ~>. π
π OPTIONS π
in addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pbmtextps recognizes the following command line options:
-font=fontnameβ this specifies the font to use. fontname is the name of any valid Postscript font which is installed on the system. the default isTimesRoman. here's a way to get a list of the names of all the available fonts:
$ gs -c '(*) {==} 256 string /Font resourceforall'
β οΈ warning: if fontname does not name a valid font, pbmtextps just uses the default font. it does not tell you it is doing this. sneaky behaviour fr fr π
-fontsize=floatβ this is the size of the font in points. see the-resolutionoption for information on how to interpret this size. the default is 24 points. before Netpbm 10.75 (June 2016), this has to be a whole number.-resolution=nβ this is the resolution in dots per inch of distance measurements pertaining to generation of the image. PBM images don't have any inherent resolution, so a distance such as "1 inch" doesn't mean anything unless you separately specify what resolution you're talking about. that's what this option does. in particular, the meaning of the font size is determined by this resolution. if the font size is 24 points and the resolution is 150 dpi, then the font size is 50 pixels. the default is 150 dpi. π-leftmargin=nβ controls a margin added to the image, measured from the far edge of the type. see Margins for details. all sizes are in points, as a floating point number. this option was new in Netpbm 10.75 (June 2016). β¨-rightmargin=nβ controls a margin added to the image, measured from the far edge of the type. see Margins for details. all sizes are in points, as a floating point number. this option was new in Netpbm 10.75 (June 2016). β¨-topmargin=nβ controls a margin added to the image, measured from the far edge of the type. see Margins for details. all sizes are in points, as a floating point number. this option was new in Netpbm 10.75 (June 2016). β¨-bottommargin=nβ controls a margin added to the image, measured from the far edge of the type. see Margins for details. all sizes are in points, as a floating point number. this option was new in Netpbm 10.75 (June 2016). β¨-ascent=nβ this controls a margin added to the image, measured from the text baseline. see Margins for details. sizes are in points, as a floating point number. this option was new in Netpbm 10.75 (June 2016). π-descent=nβ this controls a margin added to the image, measured from the text baseline. see Margins for details. sizes are in points, as a floating point number. this option was new in Netpbm 10.75 (June 2016). π-padβ this pads the image on the top and bottom to where the highest and lowest characters in the font would reach, even if you don't have those characters in your text. see Margins for details. this option was new in Netpbm 10.75 (June 2016). π-cropβ this makes the program crop all sides to the far edge of the type. it is the same as-leftmargin=0 -rightmargin=0 -topmargin=0 -bottommargin=0. see Margins for details. this option was new in Netpbm 10.75 (June 2016). βοΈ-asciihexβ this means the text in the arguments is in Postscript ASCII-HEX code. see Input Text. you cannot specify this together with-ascii85. this option was new in Netpbm 11.02 (March 2023). π-ascii85β this means the text in the arguments is in Postscript ASCII-85 code. see Input Text. you cannot specify this together with-asciihex. this option was new in Netpbm 11.02 (March 2023). π-stroke=nβ this is the width of line, in points, to use for stroke font. there is no default stroke width because the characters are solid by default. βοΈ-verboseβ this option makespbmtextpsdisplay extra information on Standard Error about its processing. she's chatty, we love her π£οΈ-dump-psβ this option makespbmtextpswrite to Standard Output the Postscript program it would use to create the image, rather than the image itself. you can use this as input to a Postscript interpreter (such as Ghostscript or a printer) or to understand the program better. this option was new in Netpbm 10.75 (June 2016). π₯
πΈ USAGE πΈ
you can generate antialiased text by using a larger resolution than the default and scaling the image down using pamscale. soft edges? immaculate. π¦
see the manual for the similar pbmtext for more advice on usage.
π HISTORY π
pbmtextps was added to Netpbm in Release 10.0 (June 2002). a classic, an OG, we stan a legacy icon π
π SEE ALSO π
pbmtext(1), pamcut(1), pnmcrop(1), pamcomp(1), ppmchange(1), pnmrotate(1), pamscale(1), ppmlabel(1), pbm(1)
π AUTHOR π
Copyright (C) 2002 by James McCann
π DOCUMENT SOURCE π
this manual page was generated by the Netpbm tool makeman from HTML source. the master documentation is at
http://netpbm.sourceforge.net/doc/pbmtextps.html
and that's the whole thing bestie, no notes, you ate π β¨ this was netpbm documentation, version dated 17 February 2023, and yes it really is called the Pbmtextps User Manual(1) β go render something gorgeous with it, mwah π«ΆππΈ
π¦ where this page comes from
- debian trixie: netpbm 2:11.10.02-1 Β· MIT
- ubuntu noble: netpbm 2:11.05.02-1.1build1 Β· MIT
- ubuntu resolute: netpbm 2:11.10.02-1build1 Β· MIT
- ubuntu stonking: netpbm 2:11.13.03+ds-2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms