So you want a JPEG converted to EPS or PDF? Whom should you call?
As both EPS and PDF support the same "DCT" compressesion algorithm as JPEG, the problem is simple: the JPEG stream can be trivially included in either format. It does not need decompressing and then re-encoding with some inferior, if lossless, compression algorithm, as this won't magically undo the losses caused by the original JPEG compression. It certainly does not need decompressing and then recompressing with different JPEG parameters so as to produce an additional loss of quality.
One male chaffinch, 56KB
| Program | Output size | Lossless? | DCT in output |
|---|---|---|---|
| bmp2eps (all versions) | 71.4KB | Y | Y |
| xfig 3.2.4 | 75.0KB | Y | Y |
| gimp 2.6.12 | 500.5KB | Y | N (ASCII85 RLE) |
| scribus 1.40 | 550.8KB | Y | N (ASCII85 flate CMYK) |
| inkscape 0.48 | 583.3KB | Y | N (ASCII85 LZW) |
| xv 3.10a | 729.5KB | Y | N (hex uncompressed) |
| dia 0.97 | 790.0KB | Y | N (hex uncompressed) |
| convert 6.6.5 | 795.0KB | Y | N (hex uncompressed) |
Only bmp2eps and xfig excel here, the others all producing correct, but bloated, output.
| Program | Output size | Lossless? | DCT in output |
|---|---|---|---|
| bmp2eps (all versions) | 56.9KB | Y | Y |
| pdflatex | 59.4KB | Y | Y |
| Preview (MacOS 10.6) | 60.0KB | Y | Y |
| inkscape 0.48 | 339.2KB | Y | N (flate compressed) |
| dia 0.97 | 340.7KB | Y | N (flate compressed) |
| inkscape 1.40 | 435.5KB | Y | N (flate compressed CMYK) |
| xfig 3.2.4 | 23.2KB | N | Y |
| LibreOffice Draw 3.5.2 | 46.2KB | N | Y |
| convert 6.6.5 | 65.9KB | N | Y |
Still very few programs excelling, and several are degrading the quality of the included image without any explicit instruction to do so.
JPEGs can be losslessly extracted from EPS and PDF documents by using
psimages or pdfimages as appropriate. Two JPEGs are considered identical if their
files are identical (maybe after processing with
jpegtran -copy none -optimise
to remove extra comments etc.). They are considered different if their quantisation
tables differ. These are printed to stderr by
djpeg -verbose -verbose img.jpg > /dev/null
With luck this document will quickly go out of date. It was written in 2012.