CR2 raw files under Windows

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
ggarra13
Posts: 29
Joined: 2015-04-17T14:08:07-07:00
Authentication code: 6789

CR2 raw files under Windows

Post by ggarra13 » 2017-10-17T06:20:03-07:00

I am unable to load CR2 raw files under Windows. I compiled dcraw.exe, placed it in the path. I also tried downloading ufraw (with ufraw-batch) and also placing it in the path. However, Imagemagick does not seem to try to even run any of them.

It reports:

c:/Users/Gonzalo/Downloads/EXTRA.CR2: 435 UnableToOpenBlob 'C:/Users/Gonzalo/AppData/Local/Temp/magick-2152Y8YdvIgFV_5c.ppm': No such file or directory @ error/blob.c/OpenBlob/3094

The same code on Linux works fine. ufraw-batch gets run and the resulting image is loaded into my program. If ufraw-batch is missing, I get an error to that effect. But on Windows nothing.

I am using the following version of ImageMagick:

ImageMagick 7.0.4-10 Q32 x64 2017-10-17 http://www.imagemagick.org
Copyright (C) 1999-2015 ImageMagick Studio LLC

I also tried the same with IMDisplay and got the same results.

Bonzo
Posts: 2844
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: CR2 raw files under Windows

Post by Bonzo » 2017-10-17T07:37:25-07:00

What command are you using?

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

Re: CR2 raw files under Windows

Post by snibgo » 2017-10-17T07:49:12-07:00

As Bonzo says, what was your command? Add "-verbose" at the start to find what delegate it is running.
ggarra13 wrote:I compiled dcraw.exe, placed it in the path.
That may be the problem. Try removing the self-compiled version. Does that help?

For Windows, IM comes with a patched version of dcraw that adds an extra option "-O {filename}". If IM is using a version of dcraw without that option, it won't work.
snibgo's IM pages: im.snibgo.com

ggarra13
Posts: 29
Joined: 2015-04-17T14:08:07-07:00
Authentication code: 6789

Re: CR2 raw files under Windows

Post by ggarra13 » 2017-10-17T09:45:01-07:00

I am using ImageMagick from a custom program through the API, using the MagickWand set of functions. There's no -verbose option, therefore.

I tried IMDisplay without dcraw.exe and it worked.

Now, the question is how to load a .cr2 file from the API?

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

Re: CR2 raw files under Windows

Post by snibgo » 2017-10-17T09:49:52-07:00

ggarra13 wrote:Now, the question is how to load a .cr2 file from the API?
The same way you would load any other image file, with the MagickReadImage() function.
snibgo's IM pages: im.snibgo.com

ggarra13
Posts: 29
Joined: 2015-04-17T14:08:07-07:00
Authentication code: 6789

Re: CR2 raw files under Windows

Post by ggarra13 » 2017-10-18T06:05:39-07:00

Yes. Sorry for that. It works. I was linking against the wrong libraries. However, not all is well.
The image on Windows appears reddish, while the image on Linux appears correct. The Linux file also takes longer to open. My wild guess was that there is an embedded profile in the image and the Windows path is not applying it, but I do not see anything in the exif to support that. Can anyone tell why the Linux/Windows file differs?

Here's the image I am trying:
http://www.imaging-resource.com/PRODS/ ... 50.CR2.HTM

Here's the report from identify -verbose:

Code: Select all

Image: C:/Users/Gonzalo/AppData/Local/Temp/magick-16766IltFgx8FC86.ppm
  Base filename: E1DXINBI000050.CR2
  Format: CR2 (Canon Digital Camera Raw Image Format)
  Class: DirectClass
  Geometry: 5218x3482+0+0
  Units: Undefined
  Type: TrueColor
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 16-bit
  Channel depth:
    Red: 16-bit
    Green: 16-bit
    Blue: 16-bit
  Channel statistics:
    Pixels: 18169076
    Red:
      min: 1107 (0.0168917)
      max: 65535 (1)
      mean: 42441.5 (0.647615)
      standard deviation: 16979.1 (0.259084)
      kurtosis: -0.934121
      skewness: -0.377267
      entropy: 0.943632
    Green:
      min: 0 (0)
      max: 65535 (1)
      mean: 24996.6 (0.381423)
      standard deviation: 11529.6 (0.17593)
      kurtosis: -0.643228
      skewness: -0.109942
      entropy: 0.949224
    Blue:
      min: 0 (0)
      max: 65535 (1)
      mean: 7756.6 (0.118358)
      standard deviation: 5468.53 (0.0834445)
      kurtosis: 2.05942
      skewness: 0.806089
      entropy: 0.850271
  Image statistics:
    Overall:
      min: 0 (0)
      max: 65535 (1)
      mean: 25064.9 (0.382465)
      standard deviation: 18731.9 (0.285831)
      kurtosis: -0.732851
      skewness: 0.589644
      entropy: 0.914376
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Matte color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 5218x3482+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: Undefined
  Properties:
    date:create: 2017-10-18T09:52:55-03:00
    date:modify: 2017-10-18T09:52:55-03:00
    signature: 47fb8eed3c2a1ff00cff9ad4866ed2199ac991a69d4802be0062b9e6764bcbed
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 109MB
  Number pixels: 18.17M
  Pixels per second: 165.2MB
  User time: 0.109u
  Elapsed time: 0:01.110
  Version: ImageMagick 7.0.4-10 Q32 x64 2017-10-17 http://www.imagemagick.org

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

Re: CR2 raw files under Windows

Post by snibgo » 2017-10-18T16:38:36-07:00

The verbose setting can be set within programs, of course.

This will tell you what delegate is being used to read the CR2 file, and the settings. The delegate will be either ufraw-batch or dcraw. For dcraw, IM commonly does not use the dcraw "-w" setting, to apply the white balance as recorded by the camera, and I suspect that is the problem. You can add this to your delegates.xml file.
snibgo's IM pages: im.snibgo.com

Bonzo
Posts: 2844
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: CR2 raw files under Windows

Post by Bonzo » 2017-10-18T23:47:29-07:00

I had problems a few years ago with CR2 file; I can't remember exactly what ( image to blue ? ) but as sinbgo said you can edit the delegates file. I looked up the settings on either the ufraw or dcraw sites and modified the raw line.

From memory you can write your own delegate line and call it from your command directly instead of allowing Imagemagick to select one; but again it was a long time ago and I can not remember how now.

Post Reply