ImageMagick6 icon indicating copy to clipboard operation
ImageMagick6 copied to clipboard

Converting SVG to PNG using delegated Inkscape throws FailedToExecuteCommand without a reason

Open TheNextGuy32 opened this issue 2 years ago • 1 comments

ImageMagick version

6.7.7-6

Operating system

Windows

Operating system, version and so on

Windows 11 Home

Description

I'm trying to convert generated svgs into pngs. These Inkscape files using svg 1.2's feature flowRoot in order to specify an area where text will wrap. Since the svg content is produced on the fly I cannot know where to put newlines and must use flowroot. ImageMagick doesn't use svg 1.2 so the flowRoots don't appear in the png result.

I am attempting to use Inkscape to convert svgs to pngs by using the Inkscape delegate defined in the comment of C:\Program Files\ImageMagick-7.1.0-Q16-HDRI\delegates.xml. I believe exporting using Inkscape will fix my invisible flowroot issue, as flowroots are visible when the svg is viewed in Inkscape.

When I attempt to load an image using Wand's Image(filename=filepath), I get:

 FailedToExecuteCommand `"inkscape" "C:/Users/User/AppData/Local/Temp/magick-4xz3QdjPkX3UYiyBRMu8nYBqCuTw8_Cq" --export-filename="C:/Users/User/AppData/Local/Temp/magick-zW7J8OFWBFi58L9b_-Tcv7w34wNWy2Kl.png" --export-dpi="96" --export-background="rgb(100%,100%,100%)" --export-background-opacity="1" > "C:/Users/User/AppData/Local/Temp/magick-998jW10fOSoGe0W-fvwNGDVDNPdnXfQi" 2>&1

Oddly, Image(svgFilePath) isn't even at the svg->png step. Why would my svg:decode delegate be used when im not exporting to png?

How can I get more information as to why it failed and what might be causing the error?

Probably related, I've attempted to add Inkscape to my path to run the command myself, but the bin folder for Inkscape includes a python exe which overwrites my Python installation back to Python 2. I need to use my python to run this whole shebangy so I cannot have it in my path. The Inkscape installer does not include a "Do you want to add this to your path?" dialog.

Steps to Reproduce

<delegate decode="svg" command="&quot;rsvg-convert&quot; -o &quot;%o&quot; &quot;%i&quot;"/>
  <!-- Remove the extra space in - -export in the line below when you want to use inkscape and change export-filename to export-png for inkscape < 1.0 -->
  <delegate decode="svg:decode" stealth="True" command="&quot;inkscape&quot; &quot;%s&quot; --export-filename=&quot;%s&quot; --export-dpi=&quot;%s&quot; --export-background=&quot;%s&quot; --export-background-opacity=&quot;%s&quot; &gt; &quot;%s&quot; 2&gt;&amp;1"/>
  • pip install wand
  • In a python file, run the following using the attached image.
        svgImage = Image(filename=filepath)    
        svgImage.save(filename=outputFilepath)
        svgImage.close()
  • Receive the error below:
  Traceback (most recent call last):
  File "C:\Users\User\Documents\git\nextdaygames\templative\cardgame-template-maker\templative\lib\svgscissors\operations.py", line 42, in createArtFileOfPiece
    await client.exportSvgToJpg(artFileOutputFilepath, artFileOutputName, outputDirectory)
  File "C:\Users\User\Documents\git\nextdaygames\templative\cardgame-template-maker\templative\lib\svgscissors\client.py", line 183, in exportSvgToJpg
    with Image(filename=filepath) as image:
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\wand\image.py", line 9386, in __init__
    self.raise_exception()
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\wand\resource.py", line 225, in raise_exception
    raise e
wand.exceptions.DelegateError: FailedToExecuteCommand `"inkscape" "C:/Users/User/AppData/Local/Temp/magick-4xz3QdjPkX3UYiyBRMu8nYBqCuTw8_Cq" --export-filename="C:/Users/User/AppData/Local/Temp/magick-zW7J8OFWBFi58L9b_-Tcv7w34wNWy2Kl.png" --export-dpi="96" --export-background="rgb(100%,100%,100%)" --export-background-opacity="1" > "C:/Users/User/AppData/Local/Temp/magick-998jW10fOSoGe0W-fvwNGDVDNPdnXfQi" 2>&1' (-1) @ error/delegate.c/ExternalDelegateCommand/520

Images

capsAction-admiral

TheNextGuy32 avatar Jan 26 '23 16:01 TheNextGuy32

Why are you using version 6.7.7-6 and saying you installed ImageMagick-7.1.0-58-Q16-HDRI-x64-dll.exe?

dlemstra avatar Jan 27 '23 06:01 dlemstra