Skip to documentation
DocumentationAll documentsEnglish

BWSHRINK(1)

NAME

bwshrink - shrink a black and white bw file

On this page

SYNOPSIS

bwshrink [-u] [-w _in_width_] [-n _in_height_] [-s _squaresize_] [-f _shrink_factor_] [_infile.bw_] > _outfile.bw_

DESCRIPTION

bwshrink reads a black and white bw(5) format file and produces a scaled-down version. The program reads the entire image into memory and then scales it down to 1/factor of the original size in both dimensions. By default, bwshrink uses boxcar averaging to produce the output pixels.

OPTIONS

-u

Use pixel undersampling (nearest-neighbor decimation) instead of the default boxcar averaging.

-w in_width

Specify the input file width in pixels. The default is 512.

-n in_height

Specify the input file height (number of scanlines) in pixels. The default is 512.

-s squaresize

Set both the input file width and height to the given size in pixels.

-f shrink_factor

Set the integer scaling factor. Must be greater than 1. The default factor is 2.

-h, -?

Print a usage message and exit.

EXAMPLES

Example 1. Shrinking a 1024x1024 image
bwshrink -s 1024 -f 4 image.bw > image_small.bw

Shrinks the 1024x1024 input file image.bw by a factor of 4, producing a 256x256 output file named image_small.bw using boxcar averaging.

Example 2. Generating a thumbnail from a color render
pix-bw -e ntsc -w 2048 -n 1536 render.pix | bwshrink -w 2048 -n 1536 -f 8 -u > thumb.bw

Converts a 2048x1536 color pix(5) render to grayscale with pix-bw(1), then pipes it to bwshrink to produce a 256x192 thumbnail. The -u flag selects fast nearest-neighbor undersampling instead of averaging.

SEE ALSO

brlcad(1), bwcrop(1), bwrect(1), bwscale(1), bw(5)

BUGS

If the dimensions of the input image are not evenly divisible by the shrink factor, incorrect and bizarre output is generated.

AUTHOR

BRL-CAD Team

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