#255 DNG crop area(s) with ufraw-batch



I've just started using ufraw-batch as a delegate to imagemagick for handling dng files.

But the picture is not cropped as the DNG specifies it.
Here is the interesting part of the XMP data provided by exiftool :
Crop Left Margin : 0
Crop Right Margin : 0
Crop Top Margin : 0
Crop Bottom Margin : 0
Cropped Image Width : 3888
Cropped Image Height : 2592
Default Crop Origin : 10 5
Default Crop Size : 3888 2592
Crop Top : 0
Crop Left : 0.269117
Crop Bottom : 0.846325
Crop Right : 0.833333
Crop Angle : 0
Crop Constrain To Warp : 0

Notice that the picture is 3908x2602.
I could fall back on the "good side" by reducing the pict to 3888x2592 as mentionned, and then apply crop with the crop ratios given.
Is there a way to do it natively ? (ufraw says it has an auto-crop features, but I can't get it to work)

I also have a case where the DNG has lot of XMP data which contain information about several snapshot of the same picture. (e.g.: one for the whole picture, one for a detail, one for the whole picture in black and white, etc).
I don't know how to handle those cases properly.

I can provide test files, but not publicly.



  • Udi Fuchs

    Udi Fuchs - 2011-08-05

    It seems that handling the DNG crop was never implemented. Please e-mail me a sample DNG to udifuchs at gmail dot com.


  • Udi Fuchs

    Udi Fuchs - 2011-08-06

    I miss understood the request. I thought that the Default Crop tags were from the raw DNG file. I now see that all the tags are XMP tags created by some editor.

    I am not sure what is the use case for UFRaw to handle these tags. If your workflow involves working with another raw editor, why would you want to switch to UFRaw? Moreover, even if UFRaw did read these tags, there is no guaranty that the results would look the same.


  • Niels Kristian Bech Jensen

    @Udi: Default Crop Size and Default Crop Origin are present in most (all?) DNG files from cameras. It seems they are there to remove the border (non-image) areas. I have not seen the other tags before.

    Niels Kristian

  • Udi Fuchs

    Udi Fuchs - 2011-08-07

    @Niels: I checked a few DNG files and they indeed have the crop tags, but they crop parts of the image that looks completely usable. Do you have any example where the cropped area really needs to be cropped?

  • Niels Kristian Bech Jensen

    @Udi: No. I think the DNG format follows the camera manufacturers height and width data (both out-of-camera files and those made by Adobe DNG Converter), while DCRaw often makes a bigger image by only cropping away pixels contain no image data. By default I think we should follow DCRaw, but maybe we could offer the default cropping as an option for DNG files.

    Niels Kristian


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks