How to prevent an existing coder to grab a file

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
bablokb
Posts: 29
Joined: 2005-06-11T06:21:59-07:00

How to prevent an existing coder to grab a file

Post by bablokb »

Hello,

I have two problems with the setup of IM regarding coders/delegates:

I want to process nef-files with my own delegate, not the dng-delegate. The only way to prevent the dng-delegate to take control is to redefine the dng-decoder in delegates.xml (but then I loose the ability to process real dng files).

The same holds true with a special image-format which is xml-based. IM always identifies this as svg (and processing fails). I have added a type in mime.xml, an entry in magic.xml and an entry in delegates.xml. In my former versions of IM (6.5.4), this was enough and IM used the defined delegate. My current version (6.6.1) only uses the delegate if I give the image-type explicitly (type:filename-notation). But this is no workaround e.g. for running montage on a directory with a lot of different image-types.

Is this a bug or is there a way to tell IM not to use any predefined coders, but just to use the defined delegate? Probably the real problem is to tell IM the order in which to "guess" the image-type.

Thanks, Bernhard
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to prevent an existing coder to grab a file

Post by magick »

Modify the dng delegate in delegates.xml to point to a script. Include needed parameters as script command-line arguments (e.g. %i %o). The script can be any scripting language (e.g. Perl, bash, Python). Finally include logic in the script to use one program to read NEF and another for other formats (.e.g. CR2).
bablokb
Posts: 29
Joined: 2005-06-11T06:21:59-07:00

Re: How to prevent an existing coder to grab a file

Post by bablokb »

This workaround works for the NEF case, but not for the SVG case (my version doesn't even call the delegate for svg defined in delegates.xml).

Another point: why should I reproduce the logic to identify image-types in my script? In general IM does a very good job at this. And to stress one point again: it is a regression compared to 6.5.4. And it does not fit the logic of magic.xml/delegates.xml: why should I add entries to these files if IM just ignores the information?
Post Reply