19 lines
666 B
Python
19 lines
666 B
Python
import subprocess
|
|
|
|
def convert_svg_to_png(svg_path, png_path, dpi):
|
|
try:
|
|
subprocess.run(['C:\\Program Files\\Inkscape\\bin\\inkscape.exe', svg_path, '--export-filename', png_path, f'--export-dpi={dpi}'])
|
|
print(f"Conversion successful: {svg_path} -> {png_path} at {dpi} DPI")
|
|
except Exception as e:
|
|
print(f"Conversion failed: {e}")
|
|
|
|
# Specify your SVG and PNG file paths
|
|
input_svg_path = 'C:\\Users\\olgaw\\Desktop\\Andre\\SVGBilderProgramm\\Test\\SVGEXportTest\\images\\btb184.svg'
|
|
output_png_path = 'output_file33.png'
|
|
|
|
# Set the DPI
|
|
dpi = 300
|
|
|
|
# Call the conversion function
|
|
convert_svg_to_png(input_svg_path, output_png_path, dpi)
|