svgmanip icon indicating copy to clipboard operation
svgmanip copied to clipboard

svgexport does not work on windows

Open eyaler opened this issue 7 years ago • 4 comments
trafficstars

svgexport works from command line but i get: RuntimeError: External command svgexport failed

eyaler avatar Jan 10 '18 14:01 eyaler

Python will run it at the DOS prompt, does it work there? I never tested it on Windows, PRs are welcome.

CrazyPython avatar Jan 12 '18 00:01 CrazyPython

I don't know how to suppress the output of svgexport on Windows-- if you look at the source code, it attempts to pipe the output to /dev/null, which doesn't exist on Windows. Again, PRs are welcome.

CrazyPython avatar Sep 20 '19 12:09 CrazyPython

but at least it works with all it's major functions on Windows 10, confirmed. Thank You very much, author!!!

nakigoe avatar Sep 13 '22 16:09 nakigoe

There is an alternative to export SVGs under Windows: PYVIPS

--------------------------- convert SVG to PNG under Windows with PYVIPS -------------------- unzip and add the BIN folder with DLL's to the system PATH: https://github.com/libvips/build-win64-mxe/releases

import pyvips 
from svgmanip import Element 

output = Element(384, 356)  # size of the output file, look up the SVG code to get correct proportions!

map = Element('assets/map.svg')
#marker = Element('assets/marker.svg').scale(size_in_one_hundredth).rotate(-degrees, x_rotation_center, y_rotation_center)
marker = Element('assets/marker.svg').scale(0.5).rotate(-45, 50, 50)

output.placeat(map, 0, 0)
output.placeat(marker, 170.9, 0.08)
output.dump('output.svg')

image = pyvips.Image.thumbnail("output/output.svg", map_width)
image.write_to_file("output/output.png")  

convert SVG to PNG under Windows with PYVIPS

See my work in progress at https://github.com/nakigoe/sea/tree/main/graph_wind_create

nakigoe avatar Sep 20 '22 03:09 nakigoe