bmp2eps / bmp2pdf / bmp2png

Bmp2eps converts from BMP/GIF/PNG/JPEG/PNM/TGA to PS/EPS/PDF/PNG. So what? you might ask, so do many other programs.

When converting JPEG images to EPS or PDF, these are never decompressed then recompressed, they are simply transferred straight to PostScript or PDF, both of which support JPEG's compression algorithm, without further, potentially lossy, decompression and recompression. In 2012 I produced a comparison of how programs treat JPEGs.

When converting non-JPEG images, it tries quite hard to make the output as small as possible. It can therefore produce quite well-optimised PNG images for web pages. By default it does this losslessly, but in version 1.40 an option was added to reduce the depth of images from eight bits per channel to seven or six. This is generally not noticeable, but does further improve the compression.

And whilst originally intended to compress things well, but slowly, from version 1.45 it can also gather multiple images into a single PDF (or PS) file fairly swiftly, with the option -Rf, e.g.

bmp2pdf -Rf fig1.png fig2.bmp fig3.jpg out.pdf

The program is distributed as source, and needs remarkably few libraries, just zlib. (It uses its own PNG reader, and therefore does not require libpng.) However, for improved compression from version 1.40 one can optionally link against zopfli.

There are many other programs which attempt to shrink PNG files. Some of these are compared in this comparison of how programs produce PNGs.

Downloads

This code is provided with no form of warranty or statement of fitness for purpose, but merely under version two of the Gnu Public Licence.

(These are command-line programs. You will need to download them, then, on MacOS, probably make them executable (chmod +x bmp2eps).)

The MacOS version which includes libzopfli requires me to add that libzopfli is distributed under the Apache licence 2.0, but I believe that I am permitted to distribute a binary like this.

The Linux version is linked against a shared libzopfli, so one may need to install this using something similar to:

$ sudo apt-get install libzopfli1

Other comments

The program for performing the opposite conversion, that of finding JPEG images in PostScript files, and extracting them to JPEGs without any decompression and recompression stages, is psimages, which relies on ghostscript. For the same applied to PDF files, it is pdfimages from xpdf.

Bmp2eps can also output HP's RTL in the format that its large format printers understand, from the old DesignJet 1050 series of printers to the much more recent Z5600. This enables one to transfer very large images, pre-rasterised, as a continuous stream so that the printer never needs to hold the whole image in memory, but can simply print a pass and discard it.

And finally it can output JPEG or PNG files Base64 encoded for inline inclusion in web pages.

The previous release, 1.30b, is available as bmp2eps-1.30b.tgz.