Page 1 of 1

Resizing behavior aligned to Lightroom

Posted: 2017-10-14T21:10:26-07:00
by colinbowern
I have a DNG image in Lightroom which is 6000x3376 pixels at 96dpi. When I export it as a JPG at Quality 85 using the Image Sizing options:
  • Resize to Fit Width & Height
  • Don't Enlarge
  • 3840W, 2160H, 72 PPI
I get an image which is 3839x2160 at 72dpi.

When I run "convert -resize 3840x2160> -quality 85" I get an image which is 3246x2160 at 72dpi. I would expect the result to have the same dimensions as the Lightroom export. Any advice appreciated!

Re: Resizing behavior aligned to Lightroom

Posted: 2017-10-14T22:24:58-07:00
by fmw42
I don't know much about DNG files.

Lightroom resize to Fit Width and Height may be changing the aspect ratio. Let's test. 3840/6000=0.64 and 2160/3376=0.6398. Thus your results from Lightroom show that the resulting image is preserving the aspect ratio. ImageMagick will also preserve the aspect ratio, unless you use the flag "!", which you did not.


Code: Select all

convert -size 6000x3376 xc:white -resize "3840x2160>" -format "%wx%h" info:

This is only 1 pixel different from 3840x2160

So something is wrong with your convert command or something is odd in your DNG file or you misreported the ImageMagick resulting file size.

Since DNG is a photoshop proprietary format and is a type of raw format, the image may be different size than you specified due to unseen borders or virtual canvas. Lightroom may only report the size you have specified. But typically for raw formats you have to tell it the size. This may or may not be needed for DNG if that is known to photoshop and not to the DNG reader due to it being stored in photoshop proprietary tags. Again I know little about DNG and one of the DNG users may be able to shed more light.

What is your IM version and platform/OS? Please always provide that. Also it would be helpful if you post your DNG file to some free hosting service that won't change the format or zip it first and put the URL here. Then we can review the file better and test with it.


According to the ImageMagick Formats page:
DNG R Digital Negative Requires an explicit image format otherwise the image is interpreted as a TIFF image (e.g. dng:image.dng).
So try

Code: Select all

convert dng:image.dng -resize "3840x2160>" image.jpg

Re: Resizing behavior aligned to Lightroom

Posted: 2017-10-15T03:33:41-07:00
by snibgo
I suspect, as Fred suggests, that IM is reading the DNG as a tiff, so the raw image is not read and processed. Instead, the thumbnail is used. From DSLRs the "thumbnail" is often a slightly trimmed version of the raw image.

@colinbowern: what size does IM think your DNG is? Try "identify yourfile.dng".

Re: Resizing behavior aligned to Lightroom

Posted: 2017-10-15T11:01:04-07:00
by fmw42
Probably need to use the following to get the dng image size vs what snibgo wrote that likely gets the tiff image size.

Code: Select all

identify dng:yourfile.dng

Re: Resizing behavior aligned to Lightroom

Posted: 2017-10-22T06:10:37-07:00
by colinbowern
I am running ImageMagick 7.0.5-10 Q16 x86_64 2017-06-05 on Alpine Linux (working to create a Docker container which converts my inbound raw images to screen JPGs).

When I run:

Code: Select all

identify dng:/data/input/20150205-009.dng
I get back:

Code: Select all

dng:/data/input/20150205-009.dng=>/tmp/magick-46ag-ImBJdLLhD.png DNG 6048x4024 6048x4024+0+0 16-bit sRGB 107.746MiB 0.020u 0:00.010
I noticed that it is picking up 6048x4024 rather than 6000x3376 which explains the 3246x2160 conversion as that is what comes out when I run:

Code: Select all

convert -size 6048x4024 xc:white -resize "3840x2160>" -format "%wx%h" info:
I have posted the DNG file in a zip file here:!AkKW792Yejj1j8ZlGQO1YQFCG9A30Q

I can't see anywhere in Lightroom where the 6048x4024 resolution is coming from. All of the metadata panels show the original 6000x3376 resolution.

Re: Resizing behavior aligned to Lightroom

Posted: 2017-10-22T06:27:09-07:00
by snibgo
Okay, so your problem is the opposite to what I thought it was. IM is giving you an image larger than you expected.

Most cameras work like that. They have image sensors with more pixels then they advertise. The reason for this is that some lenses at some apertures don't shine light on the entire sensor. So the in-camera JPEG processor crops the image from the sensor, to omit those pixels.

Software like Lightroom does the same thing.

But those pixels are present in the raw file, and a raw converter can read them. You don't say what converter your IM is using: dcraw or ufraw-batch. I know that dcraw will happily read all the pixels, and pass them to IM. I don't know about ufraw.

EDIT to add: That explains 6000 => 6048. But the 3376 => 4024 is more than just a few pixels. And that would be a strange size: 6000x3376 pixels is a weird size, nearly 2:1 aspect ratio.