phd-simscape-micro-station/figs/inkscape/convert_svg.sh

19 lines
545 B
Bash
Raw Normal View History

2024-11-05 23:10:11 +01:00
#!/bin/bash
# Directory containing SVG files
INPUT_DIR="."
# Loop through all SVG files in the directory
for svg_file in "$INPUT_DIR"/*.svg; do
# Check if there are SVG files in the directory
if [ -f "$svg_file" ]; then
# Output PDF file name
pdf_file="../${svg_file%.svg}.pdf"
png_file="../${svg_file%.svg}"
# Convert SVG to PDF using Inkscape
inkscape "$svg_file" --export-filename="$pdf_file" && \
pdftocairo -png -singlefile -cropbox "$pdf_file" "$png_file"
fi
done