Skip to content

svg->png fails with inkscape and fallbacks to default renderer (only in python) #678

@subutchik

Description

@subutchik

I recently changed debian machine and forgot to log how i got it working, but now with wand library it fails to convert svg to png, though on windows it doesn't.

When using convert it does work on debian
Maybe you know what quirk i need to resolve? I remember it wasn't that hard, i edited delegates.xml or/and installed some packages at max.

SVG:
Image

Code:

from wand.image import Image
from io import BytesIO

svg = open('fig.svg', 'rb').read()

with Image(file=BytesIO(svg), format='svg') as img:
	img.format = 'png'
	img.resize(1000, 500, filter = 'lanczos')
	img.quantize(64, colorspace_type = 'srgb')
	img.strip()
	img.save(filename='fig.png')

ImageMagick 7.1.2-8, Inkscape 1.4.2

Console output:
** (inkscape:2579): WARNING **: 13:14:09.132: Failed to wrap object of type 'PangoFT2FontMap'. Hint: this error is commonly caused by failing to call a library init() function.

** (inkscape:2579): WARNING **: 13:14:09.251: Can't open file: /tmp/magick-6bCpVXeGT4yNAOO6t1DEBBjnjzSgrTNh (doesn't exist)

** (inkscape:2579): WARNING **: 13:14:09.251: Could not detect file format. Tried to open it as an SVG anyway but this also failed.

** (inkscape:2579): WARNING **: 13:14:09.251: Can't open file: /tmp/magick-6bCpVXeGT4yNAOO6t1DEBBjnjzSgrTNh (doesn't exist)
ink_file_open: '/tmp/magick-6bCpVXeGT4yNAOO6t1DEBBjnjzSgrTNh' cannot be opened!
InkscapeApplication::document_open: Failed to open: /tmp/magick-6bCpVXeGT4yNAOO6t1DEBBjnjzSgrTNh
ConcreteInkscapeApplication::on_open: failed to create document!

RSVG output (if needed):
rsvg-convert version 2.61.3

libraries used:
cairo 1.18.4
pango 1.56.3
harfbuzz 12.1.0
fontconfig 2.15.0

Delegates:

  <delegate decode="svg" command="&apos;rsvg-convert&apos; --dpi-x %x --dpi-y %y -o &apos;%o&apos; &apos;%i&apos;"/>
  <!-- Change export-filename to export-png for inkscape < 1.0 -->
  <delegate decode="svg:decode" stealth="True" command="&quot;inkscape&quot; &quot;%s&quot; &quot;--export-filename=%s&quot; &quot;--export-dpi=%s&quot; &quot;--export-background=%s&quot; &quot;--export-backgro>  <delegate decode="tiff" encode="text" command="&apos;tesseract&apos; &apos;%i&apos; &apos;%u&apos;; /bin/mv &apos;%u.txt&apos; &apos;%o&apos;"/>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions