This project has moved and is read-only. For the latest updates, please go here.

Open raw images

Jun 6, 2013 at 4:41 PM
I'm trying to open a CR2 raw image from a Canon camera but I get the exception UnableToOpenBlob `C:/.../AppData/Local/Temp/magick-1096qq7lCu64cJT6.ppm': No such file or directory @ error/blob.c/OpenBlob/2644

Can someone give me some help?
Jun 6, 2013 at 5:32 PM
Edited Jun 6, 2013 at 8:28 PM
Can you provide me with a link to one of your images? That makes it easier for me to determine the problem. And which version of Magick.NET are you using?

edit:
It seems that you need a program called dcraw.exe to convert the cr2 file. You can get it by from the zip file ImageMagick-6.X.X-X-Q16-x86-windows.zip from http://www.imagemagick.org/script/binary-releases.php#windows. I think you have to put the executable in the same directory as the ImageMagick dll's.
Jun 6, 2013 at 10:44 PM
Here is a link to the image http://audaxperginebasket.it/media/images/image.CR2

I tried with the dcraw.exe in the dll's directory but the result is the same: exception UnableToOpenBlob when I try to read the image
MagickImage image = new MagickImage(path_to_the_image);
or
MagickImage image = new MagickImage();
image.Read(path);
Jun 7, 2013 at 6:12 AM
I am unable to download your file, it stops at 2.6mb. I used another CR2 image I found online and I got it to work. Did you place the dcraw.exe in the directory that contains delegates.xml and CORE_RL_Magick++.dll_? What is the result of:
using (MagickImage image = new MagickImage())
{
  image.Verbose = true;
  image.Read(path);
}
Jun 7, 2013 at 8:53 AM
I placed the dcraw.exe in the directory as you suggested but it doesn't work. I tried with these images https://code.google.com/p/rawtohdri/downloads/detail?name=Canon_CR2_2.zip&can=2&q= as well and I get the UnableToOpenBlob error anyway.

I tried doing dcraw.exe image.CR2 from the command line and it generates image.ppm in the same directory. But if you look at the exception it says 'C:/.../AppData/Local/Temp/magick-1096qq7lCu64cJT6.ppm': No such file or directory.

Oh, ok, I figured out! I had ImageMagick installed and dcraw was in the system path. So when trying to read an image, the dcraw used was the one from IM and not the one in my bin folder.

Thanks for you help
Jun 7, 2013 at 10:08 AM
I will put this information somewhere in the documentation so other people won't run into the same problem.
May 29, 2014 at 12:58 PM
Having the same problem opening CR2 file. I put Magick.NET-x86.dll into Lib directory and add reference to it in my project. Then copy dcraw.exe to both Lib and bin folder. But still get this error "Magick: unable to open image C:/Users/.../AppData/Local/Temp/magick-7192nOMAXiAOSc6A.ppm': No such file or directory @ error/blob.c/OpenBlob/2658"
I don't have ImageMAgick installed in my system. So dcraw is not in system path in my case. The inner exception says {"Magick: Delegate failed
dcraw.exe -6 -w -O \"%u.ppm\" \"%i\"' @ error/delegate.c/InvokeDelegate/1153"}
Also I tried to change command in delegates.xml to call for dcraw.exe from d:\ root directory and also copy dcraw.exe there. Still no luck.
Please, help
May 29, 2014 at 1:10 PM
Can you share a link to your CR2 image? It is possible that dcraw is unable to read your image. You can also execute the following command in a command prompt to test this:
dcraw.exe -6 -w -O output.ppm input.cr2
May 29, 2014 at 1:22 PM
I used StillLife.CR2 from Magick.NET.Samples\Samples\Magick.NET\Files\ in source code.
Command line in cmd creates output.ppm without any errors or warnings.
It looks strange for me that inner exception in my project leaves this "%u.ppm" "%i"' instead of showing real files path. Isn't it a problem?

Also tried to run ReadRawImageFromCameraSamples.ConvertCR2ToJPG() from samples. Same result :(
May 29, 2014 at 1:42 PM
I can reproduce the problem if I use the AnyCPU version of Magick.NET. Not sure why this is happening but I will figure out why this bug is happening and fix it for you.
May 29, 2014 at 1:43 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
May 30, 2014 at 9:33 AM
Edited May 30, 2014 at 9:34 AM
This 33808 changeset I still have an error trying to load cr2
any cpu dll error
x86 dll error
May 30, 2014 at 10:01 AM
Edited May 30, 2014 at 10:01 AM
Did you download the latest release or are you building from source? And did you copy the dcraw.exe file inside your bin directory?
May 30, 2014 at 10:17 AM
Tried both. Same result.
May 30, 2014 at 10:27 AM
I can't find out what I'm doing wrong. Does ReadRawImageFromCameraSamples.ConvertCR2ToJPG() from Magick.NET.Samples run correctly on your side?
May 30, 2014 at 3:54 PM
Edited May 30, 2014 at 4:07 PM
Yes, I made sure it worked before I published the new release. Are you trying to do this in an application or in a website? Placing it inside the 'Bin' directory of my console application works for me. Can you try putting the dcraw.exe file inside a folder that is in %PATH%?
Aug 1, 2014 at 1:30 PM
Problem stills occurs on August 1st 2014.
When the following command is executed from the dos-prompt, dcraw fails as well:

dcraw.exe -6 -w -O output.ppm input.cr2

However, if the parameter -O is changed to lowercase, it's going well
dcraw.exe -6 -w -o output.ppm input.cr2

The newest version of dcraw (version 9.22 at August 1st 2014) expects -o parameter instead of -O.
That's why the calling functionality in ImageMagick also fails.
Aug 1, 2014 at 2:41 PM
This looks like a different problem and not that simple to fix. I think I have to see If I can integrate the code from dcraw into ImageMagick. For now you need to recompile dcraw yourself or load a modified version of delegates.xml (MagickNET.Initialize).
Aug 2, 2014 at 5:11 PM
My previous post was incorrect. It seems the -0 option was added only in the build for ImageMagick and that is why it is not working for you. You will have to use the build of dcraw.exe that was provided by ImageMagick.
Aug 4, 2014 at 12:27 PM
Edited Aug 4, 2014 at 12:31 PM
Could you please provide the correct url on which the dcraw.exe (both 32 bit and 64 bit) could be downloaded, which is compliant to ImageMagick? Thanks in advance. Advice: Include the correct dcraw.exe within the zip file you provide,
Aug 4, 2014 at 1:03 PM
I won't include the dcraw.exe executable in my zip file because it is licensed under GPL. You can find the link here: https://magick.codeplex.com/wikipage?title=Read%20raw%20image%20from%20camera&referringTitle=Documentation.
Sep 5, 2016 at 2:19 PM
Hello. I am having the same problem when converting raw format images to jpg images. When run locally, everything works fine. When run on the server (Windows server 2008 R2 ) I get "unable to open image 'C:/tempImageFolder/imagename.ppm' : No such file or directory @ error/blob.c/OpenBlob/2695 at ImageMagick.NativeInstance......" .

dcraw.exe is located in folder where imageMagick.dll is and it gets called.

I have c++ redistributable packages installed.

If I am looking at the temp folder where ImageMagick stores temporary files I can see files are created so permissions are set as needed.

Basically I get the same error like july_ant.

Please, help.
Sep 5, 2016 at 3:30 PM
Which version of the C++ redistributable did you install? I think dcraw requires the 2013 version. Magick.NET no longer required the C++ redistributable.
Sep 6, 2016 at 2:08 PM
I have both x86 and x64 versions of C++ redistributable installed on server.

I have also tried to created simple console app that does the conversion and the same error is produced but this time OS threw an error as well saying dcraw.exe has stopped working with openCL.dll Faulting Module. After that error I disabled the use of openCL in Magick.NET but I still keep getting the same error.
Sep 6, 2016 at 2:15 PM
Edited Sep 6, 2016 at 2:15 PM
Can you try the dcraw version of the latest version of ImageMagick? We fixed a bug in the OpenCL code of dcraw yesterday.
Sep 28, 2016 at 8:57 AM
Hello, similar problem here.

To convert Canon .CR2 to .JPG in my C# WPF Project (x86 / .NET 4.6) with Magick.NET-Q16-AnyCPU (7.0.3.1), i have tried:
  • dcraw.exe beside Magick.NET-Q16-AnyCPU.dll in bin folder
  • dcraw.exe inside a %PATH% folder
  • MagickNET.SetTempDirectory and/or MagickAnyCPU.CacheDirectory explicit defined (or not)
I always get:
Exception: "ImageMagick.MagickBlobErrorException" in Magick.NET-Q16-AnyCPU.dll
Exception: "ImageMagick.MagickBlobErrorException" in mscorlib.dll
unable to open image 'C:/Users/.../bin/x86/Debug/Temp/magick-8972xyHf4YIu9RRp.ppm': No such file or directory @ error/blob.c/OpenBlob/2695

The dcraw.exe file is of September 20th 2016 (a copy out of a ImageMagick version 7 installation, as above given link to version 6 Zip file is no longer available - or i'm not able to find it).

Thanks for any hint to getting .CR2 to .JPG converted
Sep 28, 2016 at 9:16 PM
I have dcraw.exe in my %PATH% and no issues reading CR2 files. Are you running your application under another user that might not have the dcraw executable in its %PATH%?
Sep 30, 2016 at 10:50 AM
sorry! My fault - shame on me!
dcraw.exe was in %PATH% but i had the file from the wrong binary release of ImageMagick (out of a 64bit "ImageMagick-7.0.3-1-Q16-x64-dll.exe" installation instead of 32bit). Now i have the draw.exe out from the portable binary "ImageMagick-7.0.3-1-portable-Q16-x86.zip" and everything works fine.
Thanks for pointing me to the right direction!