bmp2eps

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
WARRANTY
BUGS
SEE ALSO
TRADEMARKS

NAME

bmp2eps - converts various bitmap formats to EPS, PDF or PNG.

SYNOPSIS

bmp2eps [-adehlnpqrsuvxzVXZ] [-24] [-pdf] [input [output]]

DESCRIPTION

bmp2eps converts various bitmap formats to Encapsulated PostScript, PDF or PNG in a lossless fashion. Baseline JPEGs (or extended sequential DCT JPEGs) simply use the DCT filter, other formats are LZW (if enabled), Flate (if enabled), RLE or no compression. Bilevel data uses CCITT encoding if RLE requested.

By default the resulting binary data are ASCII85 encoded to produce a 7-bit clean EPS file, with options to produce PDF and keep the data binary. The PDF option does not support RLE encoding of 24 bit data.

If flate compression was enabled, PNG is also a supported output type, provided that the input is not JPEG.

PNG is a valid output if compiled with zlib and if the input is not JPEG. If compiled with libpng, PNGs will be read with libpng. If not, a more basic reader is used. If compiled without zlib, only PNGs which lack an alpha channel can be read, for these can easily be passed unchanged to EPS or PDF output.

Output is to stdout unless otherwise specified, errors and information to stderr.

The following input formats are automatically recognised and supported.

BMP

MS Windows and OS/2 bitmap. Depths of 1, 4, 8, 24 and 32 bits per pixel supported. Compressed bitmaps supported at depths of 4 and 8.

GIF

GIF87 and GIF89 containing a single image. Transparency supported.

JPEG

Colour or greyscale baseline or extended sequential DCT JPEGs.

PBM

Binary or ASCII data.

PGM

Up to 8 bit greyscale.

PNG

Only a single colour of transparency is supported.

PNM

Something which is either a PBM, PGM or PPM file (q.v.)

PPM

24 bit colour.

TGA

Greyscale, paletted or full colour, with or without RLE compression. Left to right only, and the alpha channel is ignored.

The 24 bit formats have the number of colours used counted, and are output in paletted form if the unique colour count is 256 or fewer.

A single transparent colour is supported for GIFs. Transparency results in level 3 PostScript, and PDF 1.3.

OPTIONS

−a(0-6)

(implies -p) use ISO A series paper size

−B=urx[,ury]
−B=llx,lly,urx,ury

use given bounding box. Lower left corner assumed to be zero if not given. If only urx given, ury calculated from image size

−d

add Distiller parameters to discourage Distiller from resampling or from using DCT on non JPEG images

−D[=dpi]

use dpi value from file, or from command line. Without this option, any dpi value in a JPEG or PNG file is simply ignored

−e

(implies -p) expand to fill page

−G3

use CCITT Group 3 1D encoding on bilevel images. Probably not useful.

−G4

use CCITT Group 4 2D encoding on bilevel images.

−h

show version and help text and exit

−i

use internal PNG reader, even if compiled with libpng support

−l

produce landscape output

−n

use no compression on output (no affect on JPEGs)

−p

fit to page and centre. If output was EPS, produce PostScript (i.e. include showpage and setpagedevice). Uses compiled-in default paper size (probably A4) unless another size is specified

−pdf

produce PDF. Implies -z8

−png

produce PNG. Must use FLATE compression, cannot convert JPEG input

−P=n

select PNG predictors to try with flate/LZW output and 24 bit colour or 8 bit greyscale images. Set n to the sum of the predictors wanted, where sub is 1, up is 2, av is 4 and paeth is 8. -P=0 disables prediction, -P=15 is the default (try all predictors).

−R

do not decompress PNGs. Implies -i. Default if not compiled with libz.

−q

surpress informational messages

−r

RLE compress data (ignored for JPEGs). Treated as -G4 for bilevel images.

−s

smooth output by setting interpolate true. Greatly increases time to interpret PostScript for little effect.

−t

ignore any transparency information in input (default is to respect transparancy if possible)

−t=

make white transparent (short for -t=255,255,255)

−t=r,g,b

make given colour transparent (base 10)

−u

(implies -p) use US letter paper size

−v

be verbose (more vs for more verbosity)

−V

list supported file types and exit

−x

write palette in hex, not base 85

−X

write all data in hex, not base 85

−z

Flate compress output, thus producing level 3 EPS (ignored for JPEGs)

−Z

LZW compress output, thus producing level 2 EPS (ignored for JPEGs)

−24

keep 24 bit images as 24 bit, even if they use fewer than 257 colours

−7

keep output 7-bit (default for EPS/PS)

−8

use 8-bit output (default for PDF)

If no file name is specified, input will be read from stdin.

If called as something ending in the string 2pdf then -pdf will be assumed.

In the author’s opinion, 8-bit PostScript is bad.

A utility such as jpegtran can be used to convert most non-baseline JPEGs to baseline, and to do other useful lossless transforms. Utilities such as pngtopnm (if this version was compiled without PNG support) and tifftopnm assist in dealing with other input file types.

EXAMPLES

To print a gif file to a PostScript level 2 printer

bmp2eps -pZ in.gif | lpr

The same, but landscape orientation and expanded to fill the page

bmp2eps -plxZ in.gif | lpr

To convert a bmp file to EPS for use with, for example, xfig or LaTeX

bmp2eps in.bmp > out.eps

The same for a progressively-encoded colour jpeg with the output being greyscale

jpegtran -grey -optimise in.jpeg | bmp2eps > out.eps

To produce a single page PDF file from a jpeg

bmp2eps -pdf in.jpeg > out.pdf

WARRANTY

Absolutely none. The author makes no claim that this code is fit for any purpose: use it only if you are satisfied with it. The author’s employer, the University of Cambridge, has absolutely nothing to do with this project. This version is distributed under version 2 of the GPL.

BUGS

Please report to mjr19@ (obvious University domain).

SEE ALSO

jpegtran(1), pngtopnm(1), tifftopnm(1).

TRADEMARKS

PostScript, PDF and Distiller are trademarks of Adobe Systems Incorporated. OS/2 is a trademark of IBM. Other trademarks are the property of their respective owners.