brushtopbm
Convert Sun rasterfile to portable bitmap
TLDR
Generate a PBM file as output for a Xerox doodle brush file as input
Display version
SYNOPSIS
brushtopbm [brushfile]
DESCRIPTION
brushtopbm is a utility in the Netpbm graphics package that reads brush format files—monochrome bitmaps from paint programs like xpaint(1)—and outputs them as PBM (Portable Bitmap) images.
The input brush file begins with two 16-bit little-endian unsigned integers for width and height (0-65535 pixels), followed by width × height bits of raster data. Rows are stored top-to-bottom, with bits MSB-first per byte, and padded to byte boundaries. No magic number or footer exists, so brushtopbm cannot validate input format.
This enables seamless integration of legacy brush graphics into Netpbm pipelines for manipulation (e.g., scaling, cropping) or conversion to formats like PNG, XBM, or PostScript. Output is always P4 (raw bits) PBM to stdout, preserving the exact bitmap without alteration.
Ideal for archiving or repurposing brushes in automated image processing scripts.
CAVEATS
No input validation; invalid files produce garbage PBM without error.
Dimensions limited to 65535×65535 pixels.
Input must be exactly formatted; extraneous data corrupts output.
Monchrome only—color brushes degrade to bitmaps.
EXAMPLE
brushtopbm mybrush.brush > mybrush.pbm
Or from stdin: cat mybrush.brush | brushtopbm | pnmtopng > mybrush.png
BRUSH HEADER
Bytes 0-1: width (little-endian uint16)
Bytes 2-3: height (little-endian uint16)
Bytes 4+: padded bitmap rows (MSB bit order)
HISTORY
Added to Netpbm in June 1993 (release 9.18); part of the suite since early 1990s for legacy bitmap conversion.


