V10/cmd/bcp/picfile.5

.TH PICFILE 5
.CT 1 inst_info graphics
.SH NAME
picfile \- raster graphic image format
.SH DESCRIPTION
Files in this format store images represented as two-dimensional
arrays of multiple-channel pixels.
A
.I picfile
consists of an
.SM ASCII
header followed by binary data encoding the pixels
in row-major order.
The header is a list of attribute/value pairs
separated by newlines, terminated by an
empty line.
Each header line has the form
.IB name = value.
The name may not contain an 
.SM ASCII NUL,
newline or
.LR = ;
the value may not contain null or newline.
The last line of a header is empty.
.PP
The standard attributes are described below; all but
.BR TYPE
and
.BR WINDOW
are optional.
.B TYPE
must come first; otherwise order is irrelevant.
As any unrecognised attribute is passed over uninterpreted by all standard software,
applications are welcome to include arbitrary annotations, like
.BR SHOESIZE=10 ,
if they wish.
.TP
.BI TYPE= type
How the pixels are encoded.
Standard types are
.PD 0
.RS
.TF runcode
.TP
.B runcode
A run-length encoding.
The data are a sequence of
.RI ( nchan +1)-byte
records each containing a count
.I k
and
.I nchan
bytes giving a pixel value to be repeated
.IR k +1
times.
A run may not span scanlines.
.TP
.B dump
A two-dimensional array of
.IR nchan -byte
records in row major order.
.TP
.B bitmap
One-bit pixels, packed into bytes high bit leftmost.
Zero bits are white, one bits are black.
Rows are padded with zeros to a multiple of 16 bits.
.TP
.B ccitt-g4
A black-and-white image under CCITT FAX Group 4 compression.
This format is highly compressive on images of text and line art.
Similarly,
.L ccitt-g31
and
.L ccitt-g32
for Group 3, 1-D and 2-D.
.TP
.B pico
A sequence of
.I nchan
two-dimensional arrays of single bytes.
.TP
.B ccir601
Pixels are in dump order, 2 bytes per pixel
encoded according to the IEEE digital component video standard.
.RE
.TP
.BI WINDOW= "x0 y0 x1 y1
The 
.I x,y
coordinates of the upper left corner and
the point just diagonally outside the lower right corner,
.I x
increasing to the right,
.I y
down.
.TP
.BI NCHAN= nchan
The number of channels, default 1.
.TP
.BI CHAN= value
The order of channels. 
.TP
.BI RES= "x y
The digitizing resolution horizontally and vertically, in pixels/inch.
.PD
.TP
.B CMAP=
(The value is empty.)
A color map, a 256\(mu3-byte translation table for
color values, follows the header.
In a full-color picture, each color-map row maps pixel
values of the corresponding channel.
In a monochrome picture, pixel values index
the color map to yield red, green and blue, like this:
.IP
.EX
unsigned char cmap[256][3];
red=cmap[pixel][0];
green=cmap[pixel][1];
blue=cmap[pixel][2];
.EE
.SH EXAMPLES
.TP
.B sed '/^$/q' image
Print a header.
A sample header follows.
.LP
.EX
TYPE=dump
WINDOW=0 0 512 512
NCHAN=1
CHAN=m
RES=300 300
CMAP=
COMMAND= antiquantize 'halftone CLASSIC' 512.halftone LIBERTY.anticlassic 
COMMAND=  halftone CLASSIC 512.liberty 512.halftone 1.75 512.halftone 
COMMAND=   transpose IN OUT 
COMMAND=    resample 512 IN OUT 
COMMAND=     transpose IN OUT 
COMMAND=      resample 512 IN OUT 
COMMAND=       clip 400 400 LIBERTY OUT
.EE
.SH "SEE ALSO"
.IR bcp (1),
.IR cscan (1),
.IR imscan (1),
.IR pico (1), 
.IR flicks (9.1), 
.IR mugs
in
.IR face (9.7), 
.IR rebecca (9.1),
.IR flickfile (9.5)
.br
T. Duff,
`The 10th Edition Raster Graphics System',
this manual, Volume\ 2