CR2 RAW file conversion

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
testing

CR2 RAW file conversion

Post by testing »

I'm trying to use CR2 conversion but it fails, at the moment I use the version: ImageMagick 6.5.3-2 2009-06-05 Q16 OpenMP http://www.imagemagick.org

PHP code:

Code: Select all

$thumb = new Imagick("cr2:".$_SERVER['DOCUMENT_ROOT']."/test/image/test.cr2");
$thumb->resizeImage(200, 200, Imagick::FILTER_LANCZOS, 1);
$thumb->writeImage($_SERVER['DOCUMENT_ROOT']."/test/image/test.png");
$thumb->destroy();
This code results an error like

Code: Select all

Fatal error: Uncaught exception 'ImagickException' with message 'unable to open image `/tmp/magick-XXnx4mFF.pnm': No such file or directory @ blob.c/OpenBlob/2489' in /home/user/domains/domain.nl/public_html/test/image.php:12 Stack trace: #0 /home/user/domains/domain.nl/public_html/test/image.php(12): Imagick->__construct('cr2:/home/user...') #1 {main} thrown in /home/user/domains/domain.nl/public_html/test/image.php on line 12
* User and domain are fictief.

When I use the same code with an JPG, its works fine

PHP code:

Code: Select all

$thumb = new Imagick("cr2:".$_SERVER['DOCUMENT_ROOT']."/test/image/test.jpg");
$thumb->resizeImage(200, 200, Imagick::FILTER_LANCZOS, 1);
$thumb->writeImage($_SERVER['DOCUMENT_ROOT']."/test/image/test.png");
$thumb->destroy();
PHPinfo() result also:
ImageMagick Supported formats - CR2.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: CR2 RAW file conversion

Post by fmw42 »

do you have dcraw installed? I won't say for sure, but I believe you need that. see http://www.imagemagick.org/Usage/formats/#crw
testing

Re: CR2 RAW file conversion

Post by testing »

fmw42 wrote:do you have dcraw installed? I won't say for sure, but I believe you need that. see http://www.imagemagick.org/Usage/formats/#crw
Dcraw is not installed, I will install it and reply with my experiences. Thx for your input.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: CR2 RAW file conversion

Post by magick »

ImageMagick requires the ufraw-batch delegate program to read the CR2 image format. Type
  • convert -verbose image.cr2 image.png
to confirm.
testing

Re: CR2 RAW file conversion

Post by testing »

Code: Select all

convert -verbose /home/user/domains/domain.nl/public_html/test/image/test.cr2 /home/user/domains/domain.nl/public_html/test/image/test.png
Results: " convert: error while loading shared libraries: libMagickCore.so.2: cannot open shared object file: No such file or directory "
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: CR2 RAW file conversion

Post by magick »

You need to include libMagickCore.so in your dynamic library path (e.g. ldconfig /usr/local/lib).
testing

Re: CR2 RAW file conversion

Post by testing »

magick wrote:You need to include libMagickCore.so in your dynamic library path (e.g. ldconfig /usr/local/lib).
Done

Code: Select all

convert -verbose /home/user/domains/domain.nl/public_html/test/image/test.cr2 /home/user/domains/domain.nl/public_html/test/image/test.png
Result

Code: Select all

"ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=ppm --out-depth=16 "--output=/tmp/magick-XXh7sBor.pnm" "/tmp/magick-
XXmaBUPw"
sh: ufraw-batch: command not found
convert: Delegate failed `"ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=ppm --out-depth=16 "--output=%u.pnm" "%i"'
 @ delegate.c/InvokeDelegate/1032.
convert: unable to open image `/tmp/magick-XXh7sBor.pnm': No such file or directory @ blob.c/OpenBlob/2489.
convert: missing an image filename `/home/user/domains/domain.nl/public_html/test/image/test.png' @ convert.c/ConvertImageCommand/2774.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: CR2 RAW file conversion

Post by fmw42 »

Sorry, I think IM switched from dcraw to ufraw some time ago. Probably need to install ufraw delegate library.

But it does not show in http://www.imagemagick.org/download/delegates/

so you will have to Google search online for it.
testing

Re: CR2 RAW file conversion

Post by testing »

ufraw installed also

Code: Select all

/usr/local/bin/convert cr2:/home/user/domains/domain.nl/public_html/test/image/test.cr2 /home/user/domains/domain.nl/public_html/test/image/test.png
Results:

Code: Select all

ufraw-batch: unrecognized option `--silent'
convert: Delegate failed `"ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=ppm --out-depth=16 "--output=%u.pnm" "%i"'
 @ delegate.c/InvokeDelegate/1032.
convert: unable to open image `/tmp/magick-XXIsFPtP.pnm': No such file or directory @ blob.c/OpenBlob/2489.
convert: missing an image filename `/home/user/domains/domain.nl/public_html/test/image/test.png' @ convert.c/ConvertImageCommand/2774.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: CR2 RAW file conversion

Post by magick »

Looks like you may have an older version of ufraw-batch. Edit delegates.xml and remove --silent from the dng:decode delegate.
testing

Re: CR2 RAW file conversion

Post by testing »

With an work-a-round installed ufraw 0.15

Try to test, and this results:

Code: Select all

/usr/local/bin/convert cr2:/home/user/domains/domain.nl/public_html/test/image/test.cr2 /home/user/domains/domain.nl/public_html/test/image/test.png
Results

Code: Select all

ufraw-batch: /usr/local/lib/libpng12.so.0: no version information available (required by ufraw-batch)
convert: Delegate failed `"ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=ppm --out-depth=16 "--output=%u.pnm" "%i"'
 @ delegate.c/InvokeDelegate/1032.
convert: unable to open image `/tmp/magick-XXmlKJjJ.pnm': No such file or directory @ blob.c/OpenBlob/2489.
convert: missing an image filename `/home/user/domains/domain.nl/public_html/test/image/test.png' @ convert.c/ConvertImageCommand/2774.
I have tryed something else

Code: Select all

/usr/local/bin/convert -verbose /home/user/domains/domain.nl/public_html/test/image/test.cr2 /home/user/domains/domain.nl/public_html/test/image/test.p
ng
Results

Code: Select all

"ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=ppm --out-depth=16 "--output=/tmp/magick-XXYmF3f3.pnm" "/tmp/magick-
XXvzgOrE"
ufraw-batch: /usr/local/lib/libpng12.so.0: no version information available (required by ufraw-batch)
convert: Delegate failed `"ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=ppm --out-depth=16 "--output=%u.pnm" "%i"'
 @ delegate.c/InvokeDelegate/1032.
convert: unable to open image `/tmp/magick-XXYmF3f3.pnm': No such file or directory @ blob.c/OpenBlob/2489.
convert: missing an image filename `/home/user/domains/domain.nl/public_html/test/image/test.png' @ convert.c/ConvertImageCommand/2774.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: CR2 RAW file conversion

Post by magick »

Not sure why its failing for you:
  • -> identify -version
    Version: ImageMagick 6.5.3-3 2009-06-08 Q16 OpenMP http://www.imagemagick.org
    Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

    -> convert -verbose IMG_2902.CR2 test.png
    "/usr/bin/ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=ppm --out-depth=16 "--output=/tmp/magick-XXIkJybH.pnm" "/tmp/magick-XXYLCy5F"
    /tmp/magick-XXIkJybH.pnm PNM 2314x3474 2314x3474+0+0 16-bit DirectClass 46mb
    IMG_2902.CR2=>/tmp/magick-XXIkJybH.pnm CR2 2314x3474 2314x3474+0+0 16-bit DirectClass 46mb
    IMG_2902.CR2=>test.png CR2 2314x3474 2314x3474+0+0 16-bit DirectClass 37.73mb 3.090u 0:04
testing

Re: CR2 RAW file conversion

Post by testing »

Code: Select all

identify -version
Version: ImageMagick 6.5.3-2 2009-06-05 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Maybe it's de CR2 file? Can you put your *.CR2 online? So we can test with the same file.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: CR2 RAW file conversion

Post by magick »

Post a URL to your CR2 image and we'll try it at our site.
Post Reply