Page 1 of 1

Incorrect color(whitespace) converting RAW images through LibRaw

Posted: 2019-11-25T17:31:22-07:00
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

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

Posted: 2019-11-25T17:41:20-07:00
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.

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

Posted: 2019-11-25T18:35:07-07:00
by qliu
Thanks snibgo! I'll just file a ticket to imageMagick, it would be nice to add this option

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

Posted: 2019-11-25T20:49:38-07:00
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

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

Posted: 2019-11-26T05:05:19-07:00
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.

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

Posted: 2020-04-29T18:05:24-07:00
by qliu
magick wrote:
2019-11-26T05:05:19-07:00
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.
This option didn't work for me. I'm using this version:
Version: ImageMagick 7.0.9-14 Q16 x86_64 2020-02-06 https://imagemagick.org

I tried these commands on my linux machine:
convert test.dng out2.jpg
convert test.dng -define dng:use-camera-wb=true out1.jpg

However, the out jpgs look the same. The color is different with the original dng image.
Here are the links to the output jpg and original dng:
https://drive.google.com/file/d/1RIAPYU ... sp=sharing
https://drive.google.com/file/d/1iEThhL ... sp=sharing

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

Posted: 2020-04-29T18:15:34-07:00
by fmw42
For IM 7, use magick, not convert.

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

Posted: 2020-04-29T18:47:23-07:00
by qliu
fmw42 wrote:
2020-04-29T18:15:34-07:00
For IM 7, use magick, not convert.
I just verified that magick gives the same output.
Is there any difference of using magick and convert?

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

Posted: 2020-04-29T19:28:32-07:00
by fmw42
Yes, when using IM 7 using convert will invoke IM 6 behavior, which has difference from IM 7

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

Posted: 2020-04-30T10:42:30-07:00
by qliu
fmw42 wrote:
2020-04-29T19:28:32-07:00
Yes, when using IM 7 using convert will invoke IM 6 behavior, which has difference from IM 7
Thanks for pointing that out. Is this documented somewhere? Are the command-line options and usages remain the same for magick? What are the major differences between convert and magick?

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

Posted: 2020-04-30T11:21:59-07:00
by fmw42
There are minor differences. See https://imagemagick.org/script/porting.php#cli

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

Posted: 2020-05-01T12:06:32-07:00
by qliu
Do we support -define dng:use-camera-wb=true as a command-line option? I'm using 7.0.9-14 version. I tried but the color is still not correct.

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

Posted: 2020-05-01T12:28:11-07:00
by fmw42

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

Posted: 2020-05-01T14:53:55-07:00
by dlemstra
Its use_camera_wb not use-camera-wb.