Skip to documentation
DocumentationAll documentsEnglish

BW-PNG(1)

NAME

bw-png - convert a BRL-CAD BW format image to a PNG (Portable Network Graphics) format image

On this page

SYNOPSIS

bw-png [-a] [-w _file_width_] [-n _file_height_] [-s _squaresize_] [_file.bw_] > _file.png_

DESCRIPTION

bw-png converts a BRL-CAD bw(5) format file (one unsigned byte per pixel) to a png(5) format file written to standard output. The result is a grayscale image with a bit depth of 8.

If file.bw is not specified, the image is read from standard input. By default the input is assumed to be 512x512 pixels; this can be overridden with the size options. The output is rejected if standard output is a terminal.

OPTIONS

-a

Autosize the input, deriving the width and height from the file size. Only effective when reading from a named file rather than standard input.

-w file_width

Set the width of the input to file_width pixels.

-n file_height

Set the height of the input to file_height scanlines.

-s squaresize

Set both the width and the height of the input to squaresize pixels.

-h, -?

Print a usage message and exit.

EXAMPLES

Example 1. Convert a 1024x1024 BW image to PNG
$ bw-png -s 1024 image.bw > image.png

Converts the 1024x1024 BRL-CAD BW image file image.bw to a PNG image file named image.png.

Example 2. Render a model and save it as a PNG
$ rt -s 1024 -o model.bw model.g component.r
$ bw-png -s 1024 model.bw > model.png

Ray-traces a region into a 1024x1024 grayscale bw(5) file with rt(1), then converts it to a viewable png(5) image.

SEE ALSO

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

AUTHOR

BRL-CAD Team

This software is Copyright (c) 1998-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