Skip to documentation
DocumentationAll documentsEnglish

BW-A(1)

NAME

bw-a - convert a BRL-CAD BW image to an ASCII bitmap

On this page

SYNOPSIS

bw-a [-a] [-s squaresize] [-w file_width] [-n file_height] [file.bw] > file.abm

DESCRIPTION

bw-a reads a BRL-CAD BW(5) grayscale image and writes an ASCII bitmap to the standard output, emitting one character per pixel. Pixels with a value below 127 produce a # and brighter pixels produce a -, with a newline inserted after every file_width characters so that each scanline of the image becomes a line of text.

If file.bw is not specified, the image is read from the standard input. By default the input width is assumed to be 512 pixels; this can be overridden with the -w option (or determined automatically with -a). The image is treated as being in inverse (bottom-to-top) order, so it is typically flipped before conversion.

The output is suitable for feeding to the X11 atobm(1) utility to create an X bitmap.

OPTIONS

-a

Autosize the input. When a named file is given, the width is determined from the file size rather than the default or supplied dimensions.

-s squaresize

Accepted for compatibility, but has no effect on the output; only the input width (see -w) is used when emitting scanlines.

-w file_width

Set the width of the input to file_width pixels (default 512). A newline is emitted after every file_width characters.

-n file_height

Accepted for compatibility, but has no effect on the output; the number of scanlines is determined solely by the amount of input read.

-h, -?

Print a usage message and exit.

EXAMPLES

Example 1. Convert a halftoned image into an X11 bitmap
$ pix-fb -w1280 -n960 -i -Fimage.pixi image.pix
$ pix-bw image.pixi | halftone -R -S -w1280 -n960 | \
      bw-a -w1280 -n960 | atobm -name image >image.bm

Flips a 1280x960 color image, converts it to grayscale, halftones it to a one-bit-per-pixel representation, turns that into an ASCII bitmap with bw-a, and finally pipes the result through atobm(1) to produce a usable X bitmap.

SEE ALSO

brlcad(1), bw-pix(1), bw-png(1), halftone(1), pix-bw(1), bw(5)

AUTHOR

BRL-CAD Team

This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org