70 Messages

•

1.4K Points

Tue, Jul 3, 2018 1:19 PM

# Lightroom Classic: Export → Image Sizing → Megapixels isn't precise, it produces weird image dimensions

When exporting, specifying the output image in megapixels, it produces bad numbers for width and height.

Examples for images having 3:2 ratio:

- Chose 6 mp, it results in 1999 x 2999. It should be 2000 x 3000;

- Chose 3.84 (to have 2400 x 1600) it is changed to 3.8, results in totally other width/height numbers.

- Chose 1.5 mp, it results in 1499 x 999. It should be 1500 x 2000

The input field should allow numbers up to 4 digits in precision.

Moreover the resulting image dimensions should be calculated with more precision, then rounded, to avoid unexpected numbers.

The expected output for 3:2 ratios would be:

- 3000 x 2000 for 6 mp

- 2400 x 1600 for 3.84 mp

- 1500 x 1000 for 1.5 mp

- 3600 x 2400 for 8.64 mp

It's simple math...

Examples for images having 3:2 ratio:

- Chose 6 mp, it results in 1999 x 2999. It should be 2000 x 3000;

- Chose 3.84 (to have 2400 x 1600) it is changed to 3.8, results in totally other width/height numbers.

- Chose 1.5 mp, it results in 1499 x 999. It should be 1500 x 2000

The input field should allow numbers up to 4 digits in precision.

Moreover the resulting image dimensions should be calculated with more precision, then rounded, to avoid unexpected numbers.

The expected output for 3:2 ratios would be:

- 3000 x 2000 for 6 mp

- 2400 x 1600 for 3.84 mp

- 1500 x 1000 for 1.5 mp

- 3600 x 2400 for 8.64 mp

It's simple math...

Problems

•

Updated

2 years ago

11

4

#### Helpful Widget

How can we improve?

#### Tags

No tags available

## Responses

## JohanElzenga

Champion

•

3.1K Messages

•

55.9K Points

2 years ago

exactdimensions (exactaspect ratio) of the image you started with. If I export a Sony A7R Mk III image and resize it to 6 Mpixel, I get 2999 x 2000 pixels. If I export a Canon EOS-1D X image it becomes 2999 x 1999. My other Canon cameras produce the same 2999 x 2000, but if I export a Sony A7R image it becomes 2998 x 2001.Johan W. Elzenga,

http://www.johanfoto.com

0

0

## TomM

542 Messages

•

10.6K Points

2 years ago

Take a 3:2 ratio image with dimensions of 9000x6000. Making that fit your 6MP definition means you'd have to multiply each dimension by 0.333333. Using the full precision, you'll get your perfect 3000x2000, but reduce the precision by a few decimal places to 0.333 and you'll get 2997x1998.

If you want exact sizes, I think you're better off specifying the dimensions rather than relying on the MP math.

1

## John_R_Ellis

Champion

•

5.1K Messages

•

92.5K Points

2 years ago

For example, the Sony A7R III produces images of size 7952 x 5304. These have an aspect ratio of approximately 1.49924585,

not1.5. When you ask LR to export such an image at 6 megapixels, you're asking it to export it at thesameaspect ratioas the original(1.49924585).,which is the largest size at that aspect ratio that's no larger than 6 MP (*).Two other cameras with "close" aspect ratios are the the Sony A7R and Pentax K-1 II, which are both 7360 x 4912 (1.49837134).

If you want to export at exactly 3:2 with these cameras, you'll have to first crop the image to that ratio in Develop or Library's Quick Develop. You can't do this in Export, which never changes aspect ratio (crops).

--------

(*) Here are forumulas for computing the largest size that's no larger than the specified megapixels:

exported width = round (sqrt (megapixels * 1e6 * width / height))

exported height = floor (megapixels * 1e6 / exported width)

LR appears to use these formulas.

3

## John_R_Ellis

Champion

•

5.1K Messages

•

92.5K Points

2 years ago

- Some cameras (e.g. the Sony A7R III) have aspect ratios that are close to but not exactly 1.5. Exporting such images will generally (and correclty) yield sizes that don't have ratio 1.5, since the originals don't have that ratio.

- There is a blatant bug in the megapixels sizing. It's not a "rounding error" inherent in floating-point computation, it's just a bug. LR does all of its computation with 64-bit floating point numbers, which have much more than the minimum necessary precision. Here's a sample Lua function (LR is written in Lua) that computes the correct exported sizes given a megapixels constraint:

Here's are the results of exporting various-sized test images exported at 6 megapixels, showing the original dimensions and ratio, the exported dimensions, and the dimensions as computed by the correct formula above:

Adobe has struggled with getting correct pixel dimensions before and they generally don't pay attention to these bug reports. One senior employee even claimed incorrectly that the problem with incorrect Crop ratios was inherent in floating-point computation. See:

https://feedback.photoshop.com/photoshop_family/topics/lightroom_5_export_isnt_resizing_exactly_to_s...

https://feedback.photoshop.com/photoshop_family/topics/i_cant_add_certain_custom_crop_ratios_in_ligh...

0