PIXAUTOSIZE(1)

NAME
pixautosize - determine if a file size or byte count is a standard image size

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

DESCRIPTION
pixautosize determines if a given file is one of the ``standard'' sizes used in the BRL-CAD package, i.e. one of the sizes recognized by the -a option on pix-fb(1). If the dimensions are recognized, it prints a string suitable for use in a Bourne shell sh(1) script to set the variables WIDTH and HEIGHT, e.g.

   WIDTH=512; HEIGHT=512

The file name can be specified by using the -f file_name commandline option, or the file length (in bytes) can be specified by using the -l file_length commandline option. One of these two options must be present. In either case, the -b bytes_per_sample option can be used to specify the number of bytes which are used for each sample (pixel) in the file. The default value is three (3), which is appropriate for use with pix(5) files. This should be changed to one with -b 1 when processing a bw(5) file. Similarly, the proper value for a dbw(5) file is 8 (1 channel of 8 byte samples), and the value for dpix(5) files is 24 (3 channels of 8 byte samples)

EXAMPLES

These two examples both give the result of

   WIDTH=50; HEIGHT=50;

the first could be for a bw(5) file and the second for a pix(5) file:

   pixautosize -b 1 -l 2500
   pixautosize -b 3 -l 7500

This example shows how to determine the size of a pix(5) file by giving the file name:

   pixautosize -b 3 -f ../pix/moss.pix

   WIDTH=512; HEIGHT=512

This command can be used easily in shell scripts with a line like this:

   eval `pixautosize -b 3 -f $FILE`    # sets WIDTH, HEIGHT

For a major shell script which uses this program, examine pixinfo.sh(1)

SEE ALSO
pixinfo.sh(1), pix-fb(1), libfb(3), bw(5), pix(5)

DIAGNOSTICS
If the file or file_length specified does not match any of the standard sizes, one of these messages is printed on standard error:
   pixautosize: unable to autosize nsamples=999
   pixautosize: unable to autosize file '/dev/null'
In this case, the string printed on standard output is:

   WIDTH=0; HEIGHT=0

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