Develop Canon RAW images into mutliple tiffs

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
waldalla
Posts: 10
Joined: 2011-10-02T11:12:42-07:00
Authentication code: 8675308

Develop Canon RAW images into mutliple tiffs

Post by waldalla »

What is the best way to convert a Canon raw file (CR2) into 2 or 3 differently exposed tiffs for pseudo-HDR/tonmapping?

So, from *one* RAW file I want to get a tiff with +-0EV, +1EV and -1EV. How can I do this via ImageMagick and it raw reader dcraw.

Many thanks, Walter
Last edited by waldalla on 2013-05-22T01:32:27-07:00, edited 1 time in total.
---
Walter Dallaway
* Landscape and Architecture Photography
* Creativ Exposure with Tripod and HDR
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Develop Canon RAW images into mutliple tiffs

Post by snibgo »

Can't be done. High Dynamic Range is a technique for taking multiple photographs, at different exposures, and combining them into one.

If you have only one RAW file, you can't create any number of differently exposed images from it.

However, you can create effects that look similar, using "-sigmoidal-contrast", etc.
snibgo's IM pages: im.snibgo.com
waldalla
Posts: 10
Joined: 2011-10-02T11:12:42-07:00
Authentication code: 8675308

Re: Develop Canon RAW images into mutliple tiffs

Post by waldalla »

Ups, I wasn't detailed enough: I know that I cannot use the tiffs for a real HDR, but what I want to get tiffs from the raw file with +-0EV, +1EV and -1EV using all the information available in the raw file, so that I can put them through the same HDR process
---
Walter Dallaway
* Landscape and Architecture Photography
* Creativ Exposure with Tripod and HDR
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Develop Canon RAW images into mutliple tiffs

Post by snibgo »

I work from Nikon NEF files, rather than Canon CR2, but I doubt that makes any difference. (The following commands are Windows 7 batch scripts.)

You can use IM to convert a CR2 file into something more useful:

Code: Select all

convert in.cr2 out.tiff
IM uses dcraw to read the CR2 file. I prefer to use dcraw directly:

Code: Select all

dcraw %DCRAWNR% -H %hNum% -W -g 1 1 -6 -T -c %DCRAW_PARAM% %RAW_WB% %1.nef >%BASE%.tiff
... where:
%DCRAWNR% is "-n X" where X is a noise reduction depending on the camera and ISO rating;
%hNum% is typically "0";
%DCRAW_PARAM% is typically "-w" to use the in-camera white balance, or %RAW_WB% is a specified white balance.

Then I correct geometric distortion and transverse chromatic aberration, trim off the right edge (because my camera puts weird pixels there), give it a very small unsharp mask, and convert to sRGB.

A single image may have detail in both the shadows (eg vegetation) and highlights (eg sky), with nothing important in the middle. I can increase the contrast at the extremes with "+sigmoidal-contrast". A more extreme effect involves partitioning the image into two separate images: one for the shadows, the other for highlights. Then each is processed, stretching contrast, perhaps to make the lightest parts of the vegetation white while the darkest parts of the clouds become black. These are then merged. I like this when done conservatively, and dislike it when taken to extremes, but each to his own.

Image

Image

If you want to simulate +1EV and -1EV, you might do tests with your camera to see what the actual effects are. Or you might use something very simple*, eg:

Code: Select all

convert in.tiff
( +clone -level 0,90%% -write plus1.tiff -delete )
-level 10%%,100%% minus1.tiff
* EDIT: Do this in sRGB space, not RGB. My Nikon D800 has a 10% shift per stop, except in the toe area where the values are slightly higher. Other camera models will have a different shift.

EDIT 2: Here is that final command again, slightly improved so all the tones shift by 10%.

Code: Select all

convert in.tiff
( +clone -level -10%%,90%% -write plus1.tiff -delete )
-level 10%%,110%% minus1.tiff
I don't know if any of this helps you. Feel free to ask.
snibgo's IM pages: im.snibgo.com
waldalla
Posts: 10
Joined: 2011-10-02T11:12:42-07:00
Authentication code: 8675308

Re: Develop Canon RAW images into mutliple tiffs

Post by waldalla »

Thanks a lot snibgo! This is very detailed and points me exactly in the direction I want to go!

I really like idea of faking the ISO metadata to trick the subsequent tonemapping tool. I'll try it out with Photomatix!
---
Walter Dallaway
* Landscape and Architecture Photography
* Creativ Exposure with Tripod and HDR
Post Reply