jpeg2ps converts JPEG files to PostScript level 2 EPS. In fact, jpeg2ps is not really a converter but a "wrapper": it reads the image parameters (width, height, number of color components) in a JPEG file, writes the according EPS header and then copies the compressed JPEG data to the output file. Decompression is done by the PostScript interpreter (only PostScript Level 2 and 3 interpreters support JPEG compression and decompression). If you have a slow communication channel and a fast printer, sending compressed image data is a big win.
jpeg2ps reads a JPEG file (*not* stdin) and writes a DSC-compliant EPS file containing the compressed JPEG data in PostScript format to stdout. The produced EPS files contain the necessary DSC comments including BoundingBox, so they may be imported in page layout applications. However, they do not contain preview images, so you will only see a gray box on screen.
If the auto rotate feature is activated with the -a option, images with width > height are automatically rotated to landscape mode. Don't use this option if you simply want to generate EPS files for inclusion in your documents. Note: prior to version 1.6, jpeg2ps always "autorotated" images with width > height which was especially bad for TeX users. I hope this change helps the TeX community in better using jpeg2ps!
jpeg2ps performs some sanity checks with the JPEG data. It detects several kinds of corrupt input data, but it is not absolutely foolproof. One special feature is that you can feed Macintosh JPEG files (PICT-JPEG) to jpeg2ps. These normally have several hundred bytes of additional stuff before the JPEG data. This PICT rubbish is simply ignored by jpeg2ps.
By default, jpeg2ps sends the image data in ASCII85 encoded form which is suitable for any communication channel (serial, parallel or whatever). If you are *sure* that your channel is truly 8-bit clean, you can force 8-bit data with the -b option. Note that this normally does not apply to 8-bit serial or even parallel channels since some control characters are reserved for the communications protocol. You can use binary data e.g.:
Using the -h option, jpeg2ps generates 7-bit clean data by using ASCIIHex encoding instead of the more space-efficient ASCII85 encoding.
Concerning the size of the printed image, you have three options:
jpeg2ps issues three kinds of messages:
Note that there are some JPEG producers which do not exactly conform to the specification and that the JPEG spec itself does not cover every aspect of the file format. You are on the safe side if you demand JFIF files which are happily accepted by jpeg2ps. (For further information see the JPEG FAQ by Tom Lane.)
This is what the Independent JPEG Group has to say about Photoshop CMYK files (quoted from libjpeg.doc, part of the IJG JPEG library):
Accordingly, jpeg2ps tries to detect such files (by looking for Adobes APP marker) and inverts the colors in the case of 4-component images. This inversion takes place in the PostScript setup instructions, not by changing the image data.
If you like to know more about the inner workings of jpeg2ps, the JPEG standard and its integration in PostScript Level 2, the JFIF file format, JPEG/TIFF *and* if you can read German, you may want to check out my article in a German computer magazine:
"Gut verpackt - Drucken von JPEG-Bildern mit PostScript Level 2" c't, Magazin fuer Computertechnik, Heise Verlag Hannover, 6/94, p.236 ff.
This article is also available in PDF format from my WWW page: http://www.pdflib.com/jpeg2ps/
Note that there is a related PostScript programm called "viewjpeg.ps" which is part of the Ghostscript distribution. viewjpeg.ps operates similarly to jpeg2ps, but the PostScript interpreter does the "wrapping" of JPEG data itself. With viewjpeg.ps you can e.g. view JPEG files directly within GhostScript or another interpreter with access to the file system.
jpeg2ps is available from http://www.pdflib.com/jpeg2ps/ and many other sites, notably CTAN mirrors.
Manual page by Andreas Hirczy <email@example.com>, based on the file "jpeg2ps.txt" from the original sources, version 1.5
The author accepts no responsibility for damages resulting from the use of this software and makes no warranty, either express or implied, including but not limited to, any implied warranty of merchantability or fitness for a particular purpose. This software is provided as is, and you assume all risks when using it.