BCP(1)

NAME
bcp - reformat black-and-white picture files

SYNOPSIS
bcp [ option ... ] [ file1 [ file2 ] ]

DESCRIPTION
Bcp copies black-and-white (B&W) image file1 to file2, optionally changing the file format and transforming the image. If file1 is a directory name, then every leaf of its file tree is processed in turn; and, in this case, if file2 also is specified, it is made the root directory of an isomorphic tree of output files. If file2 is not specified, all output is catenated to stdout.

Bcp can copy among all the B&W picfile(5) formats, and some others. The default output format is TYPE=ccitt-g4. Image transformations include trimming, translation, scaling, and rotation, performed in that order (not in argument order).

Input files in picfile(5) format must begin with an ASCII TYPE=type header line. Types supported both as input and output are:

dump
    One byte/pixel. NCHAN=1 is required. On input, the grey pixel values are thresholded to B&W; see option -T. On output, black becomes 0 and white 255.

bitmap
    One bit/pixel. Essentially Sun rasterfile format, with a picfile(5) header replacing the Sun binary header.

ccitt-g4
    CCITT Group 4 FAX encoding, strongly compressive on printed text. Also, ccitt-g31 (Group 3, 1-dim) and ccitt-g32 (Group 3, 2-dim; see -k).

Other supported types are:

binary
    One bit/pixel encoding; obsolescent, but needed for old image archives. Both input and output.

rle Fast run-length encoding; obsolescent, but needed for old image archives. Input or output, but not both.

pico
    Same as dump. Input only.

cdf `Compound document format', used in AT&T FAX Connection product. Input only. Only the first of multiple pages is read.

Other formats not using a TYPE=type header, are: bitfile(9.5) format; PostScript bitmap format (output only); and Sun rasterfile format (with the Sun binary header; output only).

The options are:

-B[io]
    Read/write bitfile(9.5) format (no TYPE=type header).

-M  Write TYPE=bitmap format.

-P  Write Postscript bitmap format (Suns only).

-Rx,y
    Force output resolutions to x,y (pixels/inch). If ,y is missing, it is taken to be the same as x. Overrides -xx,y. Requires a RES=x y line in the header (but, see -Z).

-R= Force the output resolution to be equal to the greater of the input resolutions.

-S  Write Sun rasterfile format (no TYPE=type header; on Suns only).

-Tt Threshold. When reading TYPE=dump, assign black to grey levels less than t, and white to others. Default: -T128.

-Zx,y
    Force input RES=x y.

-b  Write TYPE=binary format.

-g4

-4  Write TYPE=ccitt-g4 format. Similarly, -g31 or -31 and -g32 or -32.

-kn Set the `k' for ccitt-g32 encoding on output (default -k4).

-ox,y
    Offset (translate) the image by x,y pixels. The width and height of the picture are not changed.

-p  Write TYPE=dump NCHAN=1 format. Map black to 0, white to 255.

-r  Write TYPE=rle format.

-tl Rotate the image to bring the left edge of the page to the top. Set top-left corner of the rotated image at the top-left corner of the image.

-td Rotate the image d degrees counterclockwise about its center. d is a real number.

-wl,t,r,b
    Specify window (trim the image): l,t is the left-top corner and r,b the right-bottom corner measured in pixels. If the new margins are outside the original picture, the new area is set to white. An argument given as leaves the edge unchanged.

-xx,y
    Expand/contract (scale) the image, by real factors x and y. If ,y is missing, y is taken to be the same as x. May be overridden by -Rx,y. Requires a RES=x y line in the header (but, see -Z).

SEE ALSO
cscan(1), imscan(1), ocr(1), pico(1), picfile(5)
CCITT facsimile coding standards Rec. T.4(1988) and T.6(1988).

BUGS
Concatenated pages are supported, but only if each new page has a complete header.
Scaling is accomplished by naive replication/deletion of pixels.
Rotation by small angles exhibits aliasing effects, and is slow.
Rotations -tr and -tb are unfinished.
CCITT FAX `uncompressed' (or, `transparent') mode is not implemented.
Postscript output is useful only for small images.
WINDOW=l t r b where l or t is non-zero may not be handled correctly for every combination of file types.
TYPE=rle can't be both input and output.
Should be merged with T. Duff's pcp.