INNER CODE UNIT · Python

inkscape_export

utopia-rise/godot-jvm · logo/export.py:115

def inkscape_export(inkscape, svg, png, width):
    try:
        subprocess.run([str(inkscape), str(svg), f'--export-filename={png}', f'--export-width={width}'], check=True)
    except subprocess.CalledProcessError as error:
        sys.exit(f'Inkscape failed with exit code {error.returncode} while rendering {svg.name}')
    if not png.is_file():
        sys.exit(f'{inkscape} returned without writing {png}. Point PATH at the real Inkscape executable, '
                 'not a package-manager shim.')


# ------------------------------------------------------------------ 1. render the SVGs

def render_svgs(inkscape):
    # SVG renderers such as IntelliJ's icon loader draw an SVG at its declared width/height,
    # so consumers that need an exact size get their own copy with that size declared.
    ElementTree.register_namespace('', 'http://www.w3.org/2000/svg')
    svg = ElementTree.parse(REFERENCE_SVG)
    for size in SVG_SIZES:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…