Page 2 of 2

Re: Using other svg delegate

Posted: 2016-04-26T12:40:26-07:00
by tsdineen
Yes, I use the C api. My example for ImageMagick not working is display, broken down to rsvg(-view) failing.

Re: Using other svg delegate

Posted: 2016-04-26T12:46:45-07:00
by fmw42
Perhaps I do not understand fully. Are you saying that it works fine if you create an output image and then view it in some other viewer, but fails if you use display to view it directly? I do not understand the rsvg-view. Sorry, I am not an expert on svg.

Re: Using other svg delegate

Posted: 2016-04-26T13:35:26-07:00
by tsdineen
In the simplest repro, the file fails to display properly, if I use

1) display ansg011.svg
2) rsvg-view ansg011.svg
3) rsvg-convert ansg011.svg > ansg011.png
display ansg011.png

It displays properly, if I use

1) gwenview ansg011.svg
2) ksvgtopng ... ansg011.svg ansg011.png
display ansg011.png

I want to be able to change the delegate tool for svg, such that

display ansg011.svg

will use ksvgtopng, without having to pre-code the file.

Re: Using other svg delegate

Posted: 2016-04-29T09:44:47-07:00
by tsdineen
How do you setup a delegate for a KSVG: prefix? I thought it was just as simple as adding a line in the delegates.xml like

<delegate decode="ksvg" command=""/usr/bin/ksvgtopng" "%i" "%o""/>

Re: Using other svg delegate

Posted: 2016-04-29T10:08:10-07:00
by snibgo
<delegate decode="ksvg" command=""/usr/bin/ksvgtopng" "%i" "%o""/>

That's the general idea. Does it work? If not, what happens instead?

Re: Using other svg delegate

Posted: 2016-04-29T10:43:36-07:00
by tsdineen
rh6gold:dev/tls>/usr/bin/display KSVG:ansg011.svg
display: no decode delegate for this image format `/tmp/magick-geY7prO8' @ error/constitute.c/ReadImage/566.

Though I renamed the svg delegate to rsvg and that worked.
rh6gold:dev/tls>/usr/bin/display RSVG:ansg011.svg
<displays>

Re: Using other svg delegate

Posted: 2016-04-29T11:14:42-07:00
by snibgo
I don't use display or ksvgtopng as neither are available on Windows, so I can't investigate. Sorry.

Does it work with convert?

Re: Using other svg delegate

Posted: 2016-04-29T11:37:38-07:00
by tsdineen
No. It gives the same error.

Re: Using other svg delegate

Posted: 2016-04-29T11:44:25-07:00
by fmw42
This may be a dumb questions, but just checking. Did you edit the delegates.xml file in the correct directory and not just in the download folder.

On my Mac,

Code: Select all

find /usr | grep "delegates.xml"
/usr/local/etc/ImageMagick-6/delegates.xml
/usr/local/share/doc/ImageMagick-6/www/source/delegates.xml

I believe you want the one in blue. IM looks in several places for them. See http://www.imagemagick.org/script/resources.php

Re: Using other svg delegate

Posted: 2016-04-29T11:46:21-07:00
by tsdineen
Yes, it is in /etc/ImageMagick/ and it being picked up. Verified that with strace.

Re: Using other svg delegate

Posted: 2016-05-10T14:57:09-07:00
by tsdineen
I have the delegate working if I prefix display or convert with KSVG:. How do I translate that to the C api? I thought it was a matter of setting the ImageInfo->magick before calling ReadImage().

Re: Using other svg delegate

Posted: 2016-05-10T15:24:52-07:00
by tsdineen
Nevermind, I figured it out. Instead of using the ImageInfo->magick, you need to set the ImageInfo->filename to include the magick prefix.

so,

strcpy( imageinfo->filename, filename );

would need to be set to

strcpy( imageinfo->filename, "KSVG:" );
strcat( imageinfo->filename, filename );

Then you can call ReadImage().

Re: Using other svg delegate

Posted: 2016-05-10T15:32:58-07:00
by snibgo
That's how I do it.