Using other svg delegate
Re: Using other svg delegate
Yes, I use the C api. My example for ImageMagick not working is display, broken down to rsvg(-view) failing.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Using other svg delegate
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
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.
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
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""/>
<delegate decode="ksvg" command=""/usr/bin/ksvgtopng" "%i" "%o""/>
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Using other svg delegate
<delegate decode="ksvg" command=""/usr/bin/ksvgtopng" "%i" "%o""/>
That's the general idea. Does it work? If not, what happens instead?
That's the general idea. Does it work? If not, what happens instead?
snibgo's IM pages: im.snibgo.com
Re: Using other svg delegate
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>
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>
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Using other svg delegate
I don't use display or ksvgtopng as neither are available on Windows, so I can't investigate. Sorry.
Does it work with convert?
Does it work with convert?
snibgo's IM pages: im.snibgo.com
Re: Using other svg delegate
No. It gives the same error.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Using other svg delegate
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,
/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
On my Mac,
Code: Select all
find /usr | grep "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
Yes, it is in /etc/ImageMagick/ and it being picked up. Verified that with strace.
Re: Using other svg delegate
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
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().
so,
strcpy( imageinfo->filename, filename );
would need to be set to
strcpy( imageinfo->filename, "KSVG:" );
strcat( imageinfo->filename, filename );
Then you can call ReadImage().