Skip to documentation
DocumentationAll documentsEnglish

FB-PNG(1)

NAME

fb-png - save a framebuffer image as a Portable Network Graphics (PNG) file

On this page

SYNOPSIS

fb-png [-i] [-c] [-# _nbytes/pixel_] [-F _framebuffer_] [-g _gamma_] [-s _squaresize_] [-w _width_] [-n _height_] [file.png]

DESCRIPTION

fb-png reads a region of a framebuffer and saves it as a PNG (Portable Network Graphics) file. If no output file name is given, the data is written to standard output.

By default the region read is 512x512 pixels in first-quadrant order (origin at the lower left); use -s, -w, and -n to change the size. If the open framebuffer is smaller than the requested size, the region is trimmed to fit. Use png-fb(1) to display a PNG file in a framebuffer.

OPTIONS

-i

Read the framebuffer bottom-to-top, inverting the image vertically (fourth-quadrant order, origin at the upper left).

-c

Apply ("crunch") the framebuffer color map to pixel values before writing. Ignored if the framebuffer has no map or a linear one.

-# nbytes/pixel

Number of bytes per pixel: 1 for grayscale or 3 for color (the default).

-F framebuffer

Specify the framebuffer device. Defaults to the FB_FILE environment variable (see brlcad(1)).

-g gamma

Write the specified gamma correction value into the PNG gAMA chunk. A value of 0.6 approximates PC display monitors. A non-positive value (the default is -1.0) disables writing the gAMA chunk entirely.

-s squaresize

Set both width and height to squaresize pixels (default 512).

-w width

Set the width in pixels (default 512).

-n height

Set the height in pixels (default 512).

-h, -?

Print a usage message and exit.

EXAMPLES

Example 1. Render a model and capture the framebuffer to PNG
rt -s 1024 -F /dev/X moss.g all.g &
fb-png -F /dev/X -s 1024 moss.png

Ray traces the moss.g model into a 1024x1024 X11 framebuffer with rt(1), then grabs that framebuffer and saves it as a PNG image of the same size. Matching the -s size to the framebuffer ensures the whole image is captured.

Example 2. Save the lower-left quadrant of the default framebuffer
fb-png -w 256 -n 256 crop.png

Reads only a 256x256 region (anchored at the origin) from the framebuffer named by the FB_FILE environment variable and writes it to crop.png.

SEE ALSO

brlcad(1), png-fb(1), fb-bw(1), pix(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