Skip to documentation
DocumentationAll documentsEnglish

PIXAUTOSIZE(1)

NAME

pixautosize - guess the width and height of a standard-size image file

On this page

SYNOPSIS

pixautosize [-b bytes_per_sample] [-f file_name | -l file_length]

DESCRIPTION

pixautosize determines whether a file is one of the "standard" image sizes recognized by the BRL-CAD framebuffer library, the same sizes accepted by the -a (autosize) option of pix-fb(1). When a standard size is matched it prints an assignment string suitable for evaluation in a Bourne shell sh(1) script, e.g.

WIDTH=512; HEIGHT=512

The image is selected either by name with -f or by byte count with -l; exactly one of the two must be given (specifying both is an error). The number of bytes per sample (pixel) defaults to 3, which is correct for pix(5) files; use -b 1 for bw(5) files and -b 24 for dpix(5) files (three channels of 8-byte double samples).

If no standard size matches, a diagnostic is printed to standard error, WIDTH=0; HEIGHT=0 is printed to standard output, and a non-zero exit status is returned.

OPTIONS

-b bytes_per_sample

Number of bytes used per sample (pixel). Must be a positive integer. Defaults to 3.

-f file_name

Determine the size from the length of the named file. Mutually exclusive with -l.

-l file_length

Determine the size from an explicit file length in bytes. Must be a positive integer. Mutually exclusive with -f.

-h, -?

Print a usage message and exit.

EXAMPLES

Example 1. Size a pix file by name and capture the result in a shell script
eval `pixautosize -f scene.pix`   # sets WIDTH and HEIGHT
pix-fb -w $WIDTH -n $HEIGHT scene.pix

The first line evaluates the WIDTH=…​; HEIGHT=…​ string emitted by pixautosize, populating the shell variables; the second uses them to display the image with pix-fb(1).

Example 2. Size a bw file from a known byte count
pixautosize -b 1 -l 2500

Reports WIDTH=50; HEIGHT=50 for a single-channel bw(5) image of 2500 bytes. The equivalent three-channel pix(5) image would be sized with pixautosize -b 3 -l 7500.

SEE ALSO

brlcad(1), pix-fb(1), bw(5), dpix(5), pix(5), sh(1)

AUTHOR

BRL-CAD Team

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