Need Help Urgently: Convert CR2 to png

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?".
techdev
Posts: 10
Joined: 2013-10-07T11:20:28-07:00
Authentication code: 6789

Need Help Urgently: Convert CR2 to png

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Need Help Urgently: Convert CR2 to png

Post 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.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Need Help Urgently: Convert CR2 to png

Post by dlemstra »

It looks like you are missing a semicolon:
-w "%i"
Should be:
-w "%i" ;
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
techdev
Posts: 10
Joined: 2013-10-07T11:20:28-07:00
Authentication code: 6789

Re: Need Help Urgently: Convert CR2 to png

Post 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.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Need Help Urgently: Convert CR2 to png

Post by dlemstra »

Do you have access to /tmp ? You should also change 'basename "%o.ppm"' to 'basename "%i.ppm"'.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
techdev
Posts: 10
Joined: 2013-10-07T11:20:28-07:00
Authentication code: 6789

Re: Need Help Urgently: Convert CR2 to png

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Need Help Urgently: Convert CR2 to png

Post by fmw42 »

might it be that you do not have write permission from IM to /tmp?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Need Help Urgently: Convert CR2 to png

Post 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?
techdev
Posts: 10
Joined: 2013-10-07T11:20:28-07:00
Authentication code: 6789

Re: Need Help Urgently: Convert CR2 to png

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Need Help Urgently: Convert CR2 to png

Post by snibgo »

Probably not relevant, but shouldn't there be a space on both sides of the ";"?
snibgo's IM pages: im.snibgo.com
techdev
Posts: 10
Joined: 2013-10-07T11:20:28-07:00
Authentication code: 6789

Re: Need Help Urgently: Convert CR2 to png

Post 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.
techdev
Posts: 10
Joined: 2013-10-07T11:20:28-07:00
Authentication code: 6789

Re: Need Help Urgently: Convert CR2 to png

Post 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.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Need Help Urgently: Convert CR2 to png

Post 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""
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
techdev
Posts: 10
Joined: 2013-10-07T11:20:28-07:00
Authentication code: 6789

Re: Need Help Urgently: Convert CR2 to png

Post 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.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Need Help Urgently: Convert CR2 to png

Post by dlemstra »

You are missing the '-O' option.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply