JPEG converters compared

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.

The image

chaffinch test image

One male chaffinch, 56KB

The EPS results

ProgramOutput sizeLossless?DCT in output
bmp2eps (all versions) 71.4KBYY
xfig 3.2.4 75.0KBYY
gimp 2.6.12 500.5KBYN (ASCII85 RLE)
scribus 1.40 550.8KBYN (ASCII85 flate CMYK)
inkscape 0.48 583.3KBYN (ASCII85 LZW)
xv 3.10a 729.5KBYN (hex uncompressed)
dia 0.97 790.0KBYN (hex uncompressed)
convert 6.6.5 795.0KBYN (hex uncompressed)

Only bmp2eps and xfig excel here, the others all producing correct, but bloated, output.

The PDF results

ProgramOutput sizeLossless?DCT in output
bmp2eps (all versions) 56.9KBYY
pdflatex 59.4KBYY
Preview (MacOS 10.6) 60.0KBYY
inkscape 0.48 339.2KBYN (flate compressed)
dia 0.97 340.7KBYN (flate compressed)
inkscape 1.40 435.5KBYN (flate compressed CMYK)
xfig 3.2.4 23.2KBNY
LibreOffice Draw 3.5.2 46.2KBNY
convert 6.6.5 65.9KBNY

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.