Page 1 of 2

Need Help Urgently: Convert CR2 to png

Posted: 2013-10-07T11:35:53-07:00
by techdev
Hi All,

I have an urgent requirement to convert CR2 file to PNG. I have installed ImageMagick and Libraw command line tool on my linux server (application scope installation as i don't have root privilege).

Installed ImageMagick and Libraw at : /ngs/app/acto/usr/ --> which has all bin, lib and include files present in folders.

After installing libraw, i have changed my delegate.xml as below:

<delegate decode="dcraw8" command="/ngs/app/acto/usr/bin/simple_dcraw -v -w "%i" mv -f `basename "%o.ppm"` "%o""/>

and when i am trying to run below command :

/ngs/app/acto/usr/bin/convert dcraw8:Scout.CR2 Scout.png

i am getting error message as below:

Processing file /tmp/magick-18357-HDHHBvK1Wr6
Writing file /tmp/magick-18357-HDHHBvK1Wr6.ppm
Processing file mv
Cannot open_file mv: Input/output error
Processing file `basename
Cannot open_file `basename: Input/output error
Processing file /tmp/magick-18357Zyc_p8rfyraU.ppm
Cannot open_file /tmp/magick-18357Zyc_p8rfyraU.ppm: Input/output error
Processing file /tmp/magick-18357Zyc_p8rfyraU
Cannot open_file /tmp/magick-18357Zyc_p8rfyraU: Unsupported file format or not RAW file
convert: unable to open image `/tmp/magick-18357v62v3LlFcD4P': No such file or directory @ error/blob.c/OpenBlob/2643.
convert: unable to open file `/tmp/magick-18357v62v3LlFcD4P': No such file or directory @ error/constitute.c/ReadImage/591.
convert: no images defined `Scout.png' @ error/convert.c/ConvertImageCommand/3127.



Please help.

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-07T11:57:29-07:00
by fmw42
I do not know much about DCRAW and CR2 images, but it might help to identify your IM version, platform and provide the input CR2 image.

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-07T11:57:39-07:00
by dlemstra
It looks like you are missing a semicolon:
-w "%i"
Should be:
-w "%i" ;

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-07T12:12:54-07:00
by techdev
Thanks for quick response. Please find below detail as required
Version : ImageMagick 6.8.6-10 2013-10-05 Q16
Linux Version : Linux version 2.6.32-300.11.1.el5uek (mockbuild@ca-build56.us.oracle.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50))

I updated the delegate.xml with semicolon and now getting below error :

<delegate decode="dcraw8" command="/ngs/app/acto/usr/bin/simple_dcraw -v -w "%i"; mv -f `basename "%o.ppm"` "%o""/>

Error :


Processing file /tmp/magick-24470T_38BEehnxcK
Writing file /tmp/magick-24470T_38BEehnxcK.ppm
Cannot write /tmp/magick-24470T_38BEehnxcK.ppm: Unknown error code
mv: cannot stat `magick-24470ZHZkYpFX47B4.ppm': No such file or directory
convert: delegate failed `/ngs/app/acto/usr/bin/simple_dcraw -v -w "%i"; mv -f `basename "%o.ppm"` "%o"' @ error/delegate.c/InvokeDelegate/1065.
convert: unable to open image `/tmp/magick-244700X5yYdbaLl5v': No such file or directory @ error/blob.c/OpenBlob/2643.
convert: unable to open file `/tmp/magick-244700X5yYdbaLl5v': No such file or directory @ error/constitute.c/ReadImage/591.
convert: no images defined `Scout.png' @ error/convert.c/ConvertImageCommand/3127.

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-07T12:52:16-07:00
by dlemstra
Do you have access to /tmp ? You should also change 'basename "%o.ppm"' to 'basename "%i.ppm"'.

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-07T13:48:39-07:00
by techdev
yes i have access to /tmp folder...i just tried moving a file from tmp to other location and i was able to do that.

<delegate decode="dcraw8" command="/ngs/app/acto/usr/bin/simple_dcraw -v -w "%i"; mv -f `basename "%i.ppm"`. "%o""/>


-bash-3.2$ /ngs/app/acto/usr/bin/convert dcraw8:Scout.CR2 Scout.png
Processing file /tmp/magick-26380emVW0SS6VLbX
Writing file /tmp/magick-26380emVW0SS6VLbX.ppm
mv: cannot stat `magick-26380emVW0SS6VLbX.ppm.': No such file or directory
convert: delegate failed `/ngs/app/acto/usr/bin/simple_dcraw -v -w "%i"; mv -f `basename "%i.ppm"`. "%o"' @ error/delegate.c/InvokeDelegate/1065.
convert: unable to open image `/tmp/magick-26380_ZseaaKE9nlE': No such file or directory @ error/blob.c/OpenBlob/2643.
convert: unable to open file `/tmp/magick-26380_ZseaaKE9nlE': No such file or directory @ error/constitute.c/ReadImage/591.
convert: no images defined `Scout.png' @ error/convert.c/ConvertImageCommand/3127.

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-07T14:15:39-07:00
by fmw42
might it be that you do not have write permission from IM to /tmp?

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-07T14:16:29-07:00
by Bonzo
Out of interest did you try converting a CR2 file before making any changes to your setup?
I am able to convert CR2 files with the standard installation.

Have you tried converting any other file formats?

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-07T14:30:41-07:00
by techdev
I am setting this up first time on my development server and unfortunately i don't have root privilege therefore installed Imagemagick and libraw in application scope.

Can you please verify below :


<delegate decode="dcraw8" command="/ngs/app/acto/usr/bin/simple_dcraw -v -w "%i"; mv -f `basename "%i.ppm"`. "%o""/>

Red color command is converting file into ppm at /tmp location (which i can see)
Blue color command is moving/converting ppm file to output (png format)

I dont think there should be 'dot' in between and second once after converting file to ppm, i am trying to move/convert ppm file from my current directory (where actually its not present). Can any one tell me how this command works

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-07T14:41:35-07:00
by snibgo
Probably not relevant, but shouldn't there be a space on both sides of the ";"?

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-07T18:39:32-07:00
by techdev
I just setup same code to different machine with root access :

I have ImagMagick and dcraw installed there as root. Shouldn't be this working now :

<delegate decode="dcraw8" command="/opt/local/bin/dcraw -v -w "%i" ; "%o.png""/>

Error message :

sh-3.2# convert dcraw8:test.CR2 image
Loading Canon EOS 5D Mark III image from /var/tmp/magick-12683gCU23Uu2NB2e ...
Scaling with darkness 2046, saturation 15488, and
multipliers 1.965820 1.000000 1.741211 1.000000
AHD interpolation...
Converting to sRGB colorspace...
Writing data to /var/tmp/magick-12683gCU23Uu2NB2e.ppm ...
sh: /var/tmp/magick-12683kDPsq4US1sDm.png: No such file or directory
convert: delegate failed `/opt/local/bin/dcraw -v -w "%i" ; "%o.png"' @ error/delegate.c/InvokeDelegate/1065.
convert: unable to open image `/var/tmp/magick-12683SXcX5DibG4GB': No such file or directory @ error/blob.c/OpenBlob/2643.
convert: unable to open file `/var/tmp/magick-12683SXcX5DibG4GB': No such file or directory @ error/constitute.c/ReadImage/591.
convert: no images defined `image' @ error/convert.c/ConvertImageCommand/3108.

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-08T10:42:34-07:00
by techdev
HI All,

Can anyone help me here. I am setting up IM and dcraw in standard environment and just wanted to correct delegate file entry which can work.

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-08T13:14:08-07:00
by dlemstra
Are you using dcraw or dcraw_simple? They have different command line arguments. The windows delegate for dcraw is specified like this:

Code: Select all

"dcraw.exe -6 -w -O "%u.ppm" "%i""
//Your command should probably be this:
"/opt/local/bin/dcraw -6 -w -O "%u.ppm" "%i""

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-08T13:29:14-07:00
by techdev
Thanks for reply !

I am using dcraw now in my linux environment. Used below entry in delegates.xml :

<delegate decode="dcraw8" command="/opt/local/bin/dcraw -6 -w "%u.ppm" "%i""/>

Command : convert dcraw8:test.CR2 test.png

Error :
sh-3.2# convert dcraw8:test.CR2 test.png
/var/tmp/magick-19753aYPGQb0Wn69N.ppm: No such file or directory
convert: unable to open image `/var/tmp/magick-19753aDp9tTSWn3mq': No such file or directory @ error/blob.c/OpenBlob/2643.
convert: unable to open file `/var/tmp/magick-19753aDp9tTSWn3mq': No such file or directory @ error/constitute.c/ReadImage/591.
convert: no images defined `test.png' @ error/convert.c/ConvertImageCommand/3108.

Re: Need Help Urgently: Convert CR2 to png

Posted: 2013-10-08T13:37:38-07:00
by dlemstra
You are missing the '-O' option.