JPEG quality: ImageMagick or Lightroom is better?

July 30, 2011
4 min

JPEG is the most frequently used image format. It is based on the theories of human visualization and perception, and it is able compress the image size significantly, by losing some details where our eye is less aware of. Depending on the compression ratio, it loses details compared to the original pixels, but it may provide a more compact file size.

For me, the JPEG image is the last step of the photography workflow, as I shoot in RAW, convert them to DNG, process in Lightroom, and finally exporting it to JPEG. I was interested in what the right tool is for me to get a balance with the file size and the best available quality.

In this analysis I was primarily interested in the Lightroom export step: which format shall I use: JPEG, TIFF or PNG export? If I use the later ones, how will e.g. ImageMagick compare to the Lightroom export?

Converting options

The photo for my analysis was a picture of a flower. It is 18MPix image, both its TIFF and PNG version is around 84MB.

Lightroom JPEG export with quality=100

Lightroom has a built-in JPEG export (not really a surprise), and it does have a slider where you are able to set the JPEG quality between 1-100. I’ve exported my photo and the size was: 8.6MB. Nice size, excellent quality, I am not able to see any visible difference compared to the original photo in Lightroom.

Lightroom TIFF export, then ImageMagick convert with quality=100

Lightroom has a built-in TIFF export (another expected thing), and it does as it says: it exports the photo in lossless TIFF. I’ve used ImageMagick to convert the image into JPEG, with two, slightly different quality settings:

convert 2011-03-29-0153.tif -quality 100 2011-03-29-0153-im.jpg
convert 2011-03-29-0153.tif -quality  99 2011-03-29-0153-99.jpg

The file sizes are 13MB and 9.5MB, no visible differences either, same excellent quality.

Lightroom PNG export, then ImageMagick convert with quality=100

This test has the very same result as the TIFF export. Maybe it was slightly faster, but no other benefit here.


I’ve used ImageMagick’s compose tool to create a difference image from the JPEGs and the TIFF baseline:

composite 2011-03-29-0153-lr.jpg 2011-03-29-0153.tif -compose difference diff_lr.png
composite 2011-03-29-0153-im.jpg 2011-03-29-0153.tif -compose difference diff_im.png
composite 2011-03-29-0153-99.jpg 2011-03-29-0153.tif -compose difference diff_99.png

As all difference file is around 70-71MB, one needs to have a statistical analysis, first for the Lightroom version:

convert diff_lr.png -type Grayscale -verbose info:
  Channel statistics:
      min: 0 (0)
      max: 966 (0.0147402)
      mean: 171.279 (0.00261356)
      standard deviation: 95.8879 (0.00146316)
      kurtosis: 1.31163
      skewness: 1.04533

And for the ImageMagick conversions:

convert diff_im.png -type Grayscale -verbose info:
  Channel statistics:
      min: 0 (0)
      max: 681 (0.0103914)
      mean: 141.247 (0.00215529)
      standard deviation: 83.6611 (0.00127659)
      kurtosis: 1.76253
      skewness: 1.26732
convert diff_99.png -type Grayscale -verbose info:
  Channel statistics:
      min: 0 (0)
      max: 818 (0.0124819)
      mean: 156.099 (0.00238192)
      standard deviation: 92.0507 (0.0014046)
      kurtosis: 1.02586
      skewness: 1.10303

What does it mean? ImageMagick is able to produce a JPEG file that:

  • has ~40% less relative maximal difference
  • has ~20% less relative mean difference
  • has less variance in average difference
  • has less but infrequently larger deviations
  • has ~50% larger file size

From just the data point of view, ImageMagick created a JPEG version that is more closer to the original photo compared on pixel-to-pixel basis. It should be noted, that the absolute difference between them is around 0.0004%, which is a very low value.

As we have slightly lowered the ImageMagick quality, the numbers became very similar to the Lightroom’s version. Better quality, but larger file size too.


I can see no visible difference between the JPEG files. Based on the analysis, ImageMagick’s -quality 100 does make better output, but the difference does not justify the 50% increase in storage size (and costs). The slightly modified version has smaller size difference, however it is pretty close to the per-pixel numbers of the Lightroom’s JPEG.

At the moment I would like to keep my workflow simple, and exporting the photos directly to JPEG seems to be a valid and justified option. Exporting to TIFF and doing the conversion afterwards does not seem to worth the effort.

Last updated: August 29, 2014
Question? Comment?
Contact us!