Page 1 of 2
Windows cr2 conversion color issues
Posted: 2018-05-02T11:03:34-07:00
by swatty
Hello,
I am stuck on converting raw images from my Canon camera on my Windows machine and would appreciate any ideas how to resolve the issue.
I am trying to convert the raw files with the following command into a jpg image:
Code: Select all
convert [Image.cr2] -profile [Cameraprofile.icc] [Image.jpg]
That creates a jpg image, as desired, but it’s completely yellowish and I cannot figure out why. As the exact same command (with the same raw file & icc profile) creates perfect results on my linux machine.
I tried running the command from both, the portable & installed versions of 6.9.9-41 (Q16) and 7.0.7-29 (Q16) on my windows desktop and laptop, to ensure its not caused by any software on my pc. The linux device, that I tested it on is an Odroid C1 with version 6.8.9-9 Q16. The used Camera is a Canon 550D.
I have also tried to play around to set the colorspace with -colorspace RGB and sRGB, but that didn’t really help either.
The raw file:
https://www.dropbox.com/s/3wslsdcqwl1lg ... 1.cr2?dl=0
Linux Output:
https://www.dropbox.com/s/9x7ouv7awm292 ... x.jpg?dl=0
Window Output:
https://www.dropbox.com/s/rqseb5htahvp4 ... s.jpg?dl=0
So any idea, what I am missing here?
Greetings,
Re: Windows cr2 conversion color issues
Posted: 2018-05-02T11:28:43-07:00
by snibgo
What white-balance is your reader using?
IM uses one of three mechanisms to read camera-raw files. These are: dcraw, ufraw-batch, and libraw.
Personally, I find it easier to use only one program to read raw files: my hacked version of dcraw. Then I get consistency, and don't need to worry about which mechanism IM is using, and what settings (white balance, noise reduction, lens corrections etc) it is using.
Re: Windows cr2 conversion color issues
Posted: 2018-05-02T11:32:54-07:00
by swatty
I just checked with the -verbose option.
Windows uses the dcraw.exe while the odroid uses ufraw-batch, but the later one isnt included in the default windows builds or?
Greetings,
Re: Windows cr2 conversion color issues
Posted: 2018-05-02T11:49:10-07:00
by snibgo
swatty wrote:Windows uses the dcraw.exe...
IM controls dcraw from a line in delegates.xml. Does that include "-w" (lower-case)? The -w option to dcraw is "Use camera white balance, if possible". If it's not there, try adding it.
Re: Windows cr2 conversion color issues
Posted: 2018-05-02T12:07:58-07:00
by swatty
Nope thats missing, I tried yesterday already to add that, but it seems I am a bit too dump to do so
I added it to the "dng:decode" delegate as thats the only entry in my delegates file, which is actually using dcraw. But that had no effect, so I tried adding a new delegate for cr2 files with the same command, but also that didnt change anything.
Is it correct to add these things to the delegates.xml in the main folder of the installation, or do I have to put it somewhere else?
Greetings,
btw. thanks for the quick reply
edit:
Just found this thread and its a similar issue I have with the delegates file.
http://www.imagemagick.org/discourse-se ... s&start=15
I cannot override the default delegates, like dng, but if I add something unique like:
Code: Select all
<delegate decode="swatty" command="dcraw.exe -6 -w -W -O "%u.ppm" "%i""/>
it does actually override the convert command. Tough that fails with this error:
Code: Select all
dcraw.exe -6 -w -W -O "C:/Users/swatty/AppData/Local/Temp/magick-12496RcAY1itVEw7M.ppm" "C:/Users/swatty/AppData/Local/Temp/magick-12496ytV4gIzhZ9lj"
convert.exe: unable to open image `C:/Users/swatty/AppData/Local/Temp/magick-12496Wm_5XJUDx7eu': No such file or directory @ error/blob.c/OpenBlob/2761.
convert.exe: unable to open file `C:/Users/swatty/AppData/Local/Temp/magick-12496Wm_5XJUDx7eu': No such file or directory @ error/constitute.c/ReadImage/544.
convert.exe: no images defined `Image01.jpg' @ error/convert.c/ConvertImageCommand/3258.
Looks, like it expects a different tmp name for the second command?
Re: Windows cr2 conversion color issues
Posted: 2018-05-02T13:28:34-07:00
by snibgo
Try it with %o instead of %u.ppm.
Re: Windows cr2 conversion color issues
Posted: 2018-05-02T13:35:35-07:00
by fmw42
Is it correct to add these things to the delegates.xml in the main folder of the installation, or do I have to put it somewhere else?
It should be in the directory where ImageMagick installed it, not the one in the download folder. Perhaps that is what you meant, but just wanted to make sure.
Re: Windows cr2 conversion color issues
Posted: 2018-05-02T14:08:41-07:00
by swatty
snibgo wrote: ↑2018-05-02T13:28:34-07:00
Try it with %o instead of %u.ppm.
Ah perfect, that did the trick.
fmw42 wrote: ↑2018-05-02T13:35:35-07:00
It should be in the directory where ImageMagick installed it, not the one in the download folder. Perhaps that is what you meant, but just wanted to make sure.
Yeah I meant the folder where ImageMagick is installed, so the root folder with the executables.
The adjusted delegate file is now creating non yellow images, yeah
I did a quick test with another delegate, which uses a seperate installation of ufraw on windows and that seems to work as well.
dcraws output seems a bit darker on the first glance, but its getting late here, so I will compare that tomorow after I got some sleep
Thanks guys, thumbs up for the quick help. I will sum up what I did tomorrow, for the case somebody else is looking for it.
Greetings,
Re: Windows cr2 conversion color issues
Posted: 2019-02-22T10:07:44-07:00
by Jadey
I am new here, new to photography, and new to image processing. I am having the exact same problem, and have tried to recreate your solution, but to no avail.
I am on Windows 10 using the command line.
When I run
Code: Select all
magick convert -verbose 1.CR2 1.jpg
it returns:
1.CR2 CR2 3906x2602 3948x2622+42+18 16-bit sRGB 9.56773MiB 4.922u 0:02.138
1.CR2=>1.jpg CR2 3906x2602 3948x2622+42+18 16-bit sRGB 2.04593MiB 0.297u 0:00.300
It does not explicitly indicate that IM is using dcraw, but I figured I'd try recreating your solution and modify the delegates file. It seems to have no effect.
First I just added "-w"
Code: Select all
<delegate decode="dng:decode" stealth="True" command="dcraw.exe -6 -w -W -O "%u.ppm" "%i""/>
Then I tried substituting %o for %u.ppm.
Code: Select all
<delegate decode="dng:decode" stealth="True" command="dcraw.exe -6 -w -W -O "%o" "%i""/>
Nothing has changed, but again its not clear that IM is running this program.
Also, its not clear to me how to specify a profile as you mentioned upthread (-profile [Cameraprofile.icc]).
My images can be found here in Lightroom.
Any help would be appreciated.
Oops - Version info.
Version: ImageMagick 7.0.8-24 Q16 x64 2019-01-17
http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
License:
http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib
Re: Windows cr2 conversion color issues
Posted: 2019-02-22T10:40:29-07:00
by snibgo
Jadey wrote:Delegates (built-in): ... raw
Hence, IM uses a built-in delegate, not an external delegate (ie not a program such as dcraw).
Re: Windows cr2 conversion color issues
Posted: 2019-02-22T11:06:57-07:00
by Jadey
I'm really new to this. So does that mean I need to figure out a way to configure a direct call to dcraw?
Re: Windows cr2 conversion color issues
Posted: 2019-02-22T11:23:46-07:00
by snibgo
See my first reply. Personally, I use dcraw directly.
Re: Windows cr2 conversion color issues
Posted: 2019-02-22T12:15:30-07:00
by Jadey
So dcraw worked and created a PPM file, I just didn't know what a PPM file was. I was able to open it in PS and it looks fine. Were you ever able to get it to convert to a png or jpg? That was my original intent as it was in your OP.
oops sorry. It wasn't your OP. However, converting from raw to png or jpg is my ultimate goal.
Re: Windows cr2 conversion color issues
Posted: 2019-02-22T12:28:02-07:00
by fmw42
Re: Windows cr2 conversion color issues
Posted: 2019-02-22T13:19:06-07:00
by snibgo
dcraw creates PPM by default, or TIFF if you use the "-T" option. Run the program with no arguments to see the list of options.
Personally, I use dcraw to create a TIFF file, and ImageMagick to read that and do whatever processing I want and create a JPG or whatever I want.
Incidentally, a CR2 file often contains an embedded "preview" or "thumbnail" JPEG image made by the camera which exiftool can extract, if you want.