Incorrect color(whitespace) converting RAW images through LibRaw

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
qliu
Posts: 2
Joined: 2019-11-25T17:09:37-07:00
Authentication code: 1152

Incorrect color(whitespace) converting RAW images through LibRaw

Post by qliu »

Hey, I am converting some dng images to jpgs, and noticed the color of jpgs are not correct. I'm using the newest version and delegating to LibRaw.
I'm able to get the correct color by using dcraw -W option, which reads the camera whitespace. LibRaw is based on dcraw, and it seems also has a similar option named "use_camera_wb". Is this parameter disabled by default in ImageMagick? Is there any way I can enable it? Or are there some other options? Thanks

snibgo
Posts: 12896
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Incorrect color(whitespace) converting RAW images through LibRaw

Post by snibgo »

qliu wrote:I'm able to get the correct color by using dcraw -W option, which reads the camera whitespace.
I think you mean "-w" (lowercase). Uppercase "-W" disables auto-brighten.

No, IM doesn't enable camera white balance with LibRaw. This is a pain.

There are many options that you might want when processing raw images, that IM doesn't allow. Personally, I always process raw images externally, eg with dcraw to create a TIFF, then process that with ImageMagick.
snibgo's IM pages: im.snibgo.com

qliu
Posts: 2
Joined: 2019-11-25T17:09:37-07:00
Authentication code: 1152

Re: Incorrect color(whitespace) converting RAW images through LibRaw

Post by qliu »

Thanks snibgo! I'll just file a ticket to imageMagick, it would be nice to add this option

snibgo
Posts: 12896
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Incorrect color(whitespace) converting RAW images through LibRaw

Post by snibgo »

Feel free to file any tickets you want. Personally, I think IM should default to using the camera white balance. However, also remember that IM is a general-purpose system. Sometimes we need more specialist programs, and we can't add zillions of options to IM.

If you want, you can add entries to your delegates.xml. For example, I have:

Code: Select all

  <delegate decode="linrawv" command="dcraw.exe -v -4 -w -o 0 -T -O &quot;%o&quot; &quot;%i&quot;"/>
Then I can run:

Code: Select all

magick linrawv:AGA_3443.NEF -auto-level -set colorspace RGB -colorspace sRGB out.tiff
snibgo's IM pages: im.snibgo.com

User avatar
magick
Site Admin
Posts: 11215
Joined: 2003-05-31T11:32:55-07:00

Re: Incorrect color(whitespace) converting RAW images through LibRaw

Post by magick »

Set -define dng:use-camera-wb=true to use the RAW-embedded color profile for Sony cameras. This option requires ImageMagick release 7.0.9-6 or 6.9.10-75. We can add defines for other dcraw options as well. Just let us know which ones you would find useful.

Post Reply