Page 1 of 1

Can I use RSVG while still having Inkscape to convert SVG files?

Posted: 2018-09-08T11:00:23-07:00
by fmw42
I recently installed Inkscape on my Mac OSX Sierra with IM 6.9.10.11 Q16 while keeping my RSVG delegate.

Code: Select all

convert -list format
Still shows RSVG, but when I convert an SVG file to PNG with -verbose, it properly shows it using Inkscape.

Code: Select all

convert image.svg image.png
I tried

Code: Select all

convert RSVG:image.svg image.png
But that did not work.

Is there some way that I can still use RSVG, so I can compare the results with Inkscape?

Re: Can I use RSVG while still having Inkscape to convert SVG files?

Posted: 2018-09-08T11:47:12-07:00
by snibgo
IM doesn't recognise "RSVG:" as a prefix. This would be a useful enhancement to IM.

"MSVG:" is a valid prefix, to force the use of MSVG.

Otherwise, when Inkscape is on your path, IM will always use it.

Re: Can I use RSVG while still having Inkscape to convert SVG files?

Posted: 2018-09-08T12:10:06-07:00
by fmw42
I tried changing the

Code: Select all

<delegate decode="svg:decode" stealth="True" command="&quot;inkscape&quot; &quot; ...
command in the delegates.xml file to use rsvg-convert, but that failed.

Code: Select all

'rsvg-convert' '/tmp/magick-861shrDPgMVA4CJ' --export-png='/tmp/magick-861ZrimwaBF9BnC' --export-dpi='300,300' --export-background='rgb(100%,100%,100%)' --export-background-opacity='1' > '/tmp/magick-861X39YPVeQd2VV' 2>&1
convert: negative or zero image size `test.svg' @ error/image.c/SetImageExtent/2700.
convert: no decode delegate for this image format `test.svg' @ error/svg.c/ReadSVGImage/3374.
convert: no images defined `test.png' @ error/convert.c/ConvertImageCommand/3258.

Re: Can I use RSVG while still having Inkscape to convert SVG files?

Posted: 2018-09-08T14:03:14-07:00
by snibgo
fmw42 wrote:--export-png= ... --export-background=
Those are valid options for Inkscape. According to "rsvg-convert --help", they are not valid options for rsvg-convert (v2.40.20 on my Windows 8.1 laptop).

Re: Can I use RSVG while still having Inkscape to convert SVG files?

Posted: 2018-09-08T14:48:20-07:00
by fmw42
Thanks. I will have to look into it further. But I would agree that being able to do

Code: Select all

convert RSVG:image.svg ...
would be a nice addition.

Re: Can I use RSVG while still having Inkscape to convert SVG files?

Posted: 2018-09-08T16:29:39-07:00
by snibgo
I insert this line into delegates.xml:

Code: Select all

  <delegate decode="arg" command="&quot;rsvg-convert&quot; -o &quot;%o&quot; &quot;%i&quot;"/>
Then I can use "arg:" as a prefix for SVG files that I want delegated to the rsvg-convert program.

But there is a problem: on Windows, IM puts temporary files in %TEMP% which is an environment variable that expands to C:\Users\Alan\AppData\Local\Temp or whatever, and rsvg-convert doesn't like this.

The workaround is to tell IM to use something else, like ".":

Code: Select all

set MAGICK_TEMPORARY_PATH=.
Then we can:

Code: Select all

magick -verbose arg:mysvg.svg x.png
... and verbose confirms it works:

Code: Select all

"rsvg-convert" -o ".\magick-7728MN-pOkPjVz_x" ".\magick-7728zgeQzPvqQ1FW"
arg:mysvg.svg=>mysvg.svg PNG 482x579 482x579+0+0 8-bit sRGB 29780B 0.031u 0:0
.016
arg:mysvg.svg=>x.png PNG 482x579 482x579+0+0 8-bit sRGB 29961B 0.250u 0:00.187

Re: Can I use RSVG while still having Inkscape to convert SVG files?

Posted: 2018-09-08T16:56:56-07:00
by fmw42
Adding this

Code: Select all

  <delegate decode="rsvg" command="&quot;rsvg-convert&quot; -o &quot;%o&quot; &quot;%i&quot;"/>

seems to work fine for me on my Mac. I don't see any ImageMagick files left in /tmp.


convert -verbose RSVG:ellipse.svg tmp.png

'rsvg-convert' -o '/tmp/magick-4167R0fJhgX6wzgM' '/tmp/magick-4167vRZ8SGYb6iDo'
RSVG:ellipse.svg=>ellipse.svg PNG 425x142 425x142+0+0 8-bit sRGB 5952B 0.010u 0:00.000
RSVG:ellipse.svg=>tmp.png PNG 425x142 425x142+0+0 8-bit sRGB 6109B 0.010u 0:00.000




convert -verbose ellipse.svg tmp.png

'inkscape' '/tmp/magick-4173VuZO-DaUB38D' --export-png='/tmp/magick-4173pDw7pL7quJ1V' --export-dpi='72,72' --export-background='rgb(100%,100%,100%)' --export-background-opacity='1' > '/tmp/magick-4173VXgvYeUkVq8o' 2>&1
/tmp/magick-4173pDw7pL7quJ1V PNG 340x113 340x113+0+0 8-bit sRGB 5711B 0.000u 0:00.000
ellipse.svg SVG 340x113 340x113+0+0 8-bit sRGB 5711B 0.000u 0:00.000
ellipse.svg=>tmp.png SVG 340x113 340x113+0+0 8-bit sRGB 5859B 0.010u 0:00.009