Page 1 of 1

delegate libraries help

Posted: 2008-02-01T07:32:57-07:00
by homemaderobot
Hello,

I've built a site http://www.henrikknudsen.com and recruited a rails developer for a CMS and client area.

Part of the rails app uses ImageMagick to convert non-jpeg / gif / png files to jpegs so that these formats (e.g. .cr2) can be thumbnailed within the browser. However, we're apparently missing the delegate libraries required to make this happen, and installing these is outside of my developer's skillset.

If anyone is interested in helping out for a small fee, please contact me at jon@homemaderobot.com for more info.

This is my first post here so apologies if this is the wrong place for this kind of post. If so, I'd really appreciate a point in the right direction.

Many thanks

Jon

Re: delegate libraries help

Posted: 2008-02-04T12:01:46-07:00
by fmw42
I am by no means an expert at this (actually a real novice), but recently went through building IM from source and needed the delegate libraries.

You can find the libraries and installation information at:

http://www.imagemagick.org/download/delegates/

You will need the jpg and png libraries (and I added also the tiff).

Installing these is usually as simple as

cd to directory of library (look at install or readme, if necessary)
./configure
make
make install


See

http://www.imagemagick.org/download/www ... .html#unix
http://www.imagemagick.org/script/advan ... lation.php

That is about all I can do to help.

Re: delegate libraries help

Posted: 2008-02-04T17:44:19-07:00
by anthony
First just install the appropriate delegate library and see if your existing (presumably pre-build binary) will not work for that format.

If it still doesn't, the IM may not have a built 'coder' to make use of that 'library'. As a result you will then need to build IM yourself. Check the summery at the end of configuration BEFORE proceeding with the actual make.

If you asked for a specific delegate (option=yes) but the build still says 'no', then look though the previous configuration output, and the more detailed config.log file to see WHY it didn't find the delegate library.

Occasionally I have even had to go into the appropriate part of the configuration script (which is not easy to follow) to try and determine exactly why that configuration test failed. Though going to that extreme is usually quite rare.

And that is my hints and tips on this subject.

Re: delegate libraries help

Posted: 2008-02-05T02:22:37-07:00
by homemaderobot
fmw42 and Anthony thanks a million for the pointers.

I'll pass this info onto my developer when he returns from his holiday - perhaps this will give him the confidence to have a crack at it.

Still, I was hoping there may be someone out for whom this kind of stuff is a picnic, who I could recompense financially for doing it for me :)

thanks Jon

Re: delegate libraries help

Posted: 2008-04-02T04:13:35-07:00
by homemaderobot
Hello again,

my searches for a solution lead me to Dcraw as a delegate for ImageMagick - which seems to be the recommended avenue for *.CR2.

The details below are from my developer - essentially he's managed to get dcraw to work via the command line, but not via ImageMagick. Can anyone advise please?

Many Thanks

Jon

-------------------


The Configuration
-----------------
ImageMagick 6.3.7, 01/10/08, Q16, built from source
dcraw 8.53, built from source

$ convert -list configure
...
DELEGATES bzlib freetype jpeg jp2 lcms png tiff wmf x11 xml zlib
...

The Problem
-----------
Although dcraw works from the command line, I cannot get ImageMagick to use it.

$ dcraw -T img.cr2
=> img.tiff [All good.]

$ convert cr2:img.cr2 img.png
sh: ufraw-batch: command not found
convert: Delegate failed `"ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=ppm16 "--output=%u.pnm" "%i"'.
convert: unable to open image `/tmp/magick-XXOxJIR9.pnm': No such file or directory.
convert: missing an image filename `img.png'.

And, indeed, ufraw-batch is not on the PATH:

$ ufraw-batch
-bash: ufraw-batch: command not found

So it looks like ImageMagick is trying to use ufraw-batch, not dcraw, to decode cr2 images.

Here's the relevant line in delegates.xml:

<delegate decode="dng:decode" command=""ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=ppm16 "--output=%u.pnm" "%i""/>

There's no line for "cr2" decodes.

On the command line, this works:

$ /usr/local/bin/dcraw -T -w -c img.cr2 > img.tiff

So I tried replacing the dng:decode line in delegates.xml with this line:

<delegate decode="cr2" thread-support="False" command='"/usr/local/bin/dcraw" -T -w -c "%i" > "%o"' />

But this fails:

$ convert cr2:img.cr2 img.png
convert: no tag found `dng:decode'.
convert: unable to open image `.pnm': No such file or directory.
convert: missing an image filename `img.png'.

So I tried changing the decode attribute's value from "cr2" to "dng:decode". It still failed:

$ convert cr2:img.cr2 img.png
convert: no tag found `dng:decode'.
convert: unable to open image `.pnm': No such file or directory.
convert: missing an image filename `img.png'.

I also tried this:

<delegate decode="dng:decode" thread-support="False" command=""/usr/local/bin/dcraw" -T -w -c "%i" > "%o"" />

But it failed the same way.

What Now?
---------
Should I be trying to get ImageMagick to use dcraw or ufraw-batch?

Re: delegate libraries help

Posted: 2008-04-02T06:24:36-07:00
by magick
Use ufraw-batch. If you are on a Linux system it should be available from the yum repository (e.g. yum install ufraw). You might also want to upgrade to ImageMagick 6.4.0-3, the latest ImageMagick release.

Re: delegate libraries help

Posted: 2008-04-02T09:25:54-07:00
by homemaderobot
Thanks very much for your help magick. Would ImageMagick need rebuilding afterwards?

Jon

Re: delegate libraries help

Posted: 2008-04-02T09:53:32-07:00
by magick
You can simply install ufraw-batch and ImageMagick should be able to convert CR2 image files (among others). We seem to recall at least one patch that affected CR2 support that might require an upgrade to ImageMagick but try it and see if it works properly with your existing installation.