Saulo Dias
Posted on July 12, 2022
I had to convert more than one thousand SVG files from stroke to path. That's because IcoMoon.io can't handle SVG files with strokes. Instead you have to provide the SVG files for your font containing only path elements.
This bash script does the job for you. You only need to install Inkscape and add it to the Windows PATH (C:\Program Files\Inkscape\bin
in my case).
Then you run the script below in the folder with the SVG files.
bash stroke2path.sh
mkdir -p _output
for i in *.svg
do
inkscape --actions="select-all;selection-ungroup;select-all;selection-ungroup;select-all;object-stroke-to-path;" --export-filename=- $i > _output/$i
echo "done with "$i
done
The repeated actions are kind of a hack to make sure everything is ungrouped before we can convert it to path. You might get some error messages because of that, but that should not affect the end result.
Posted on July 12, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.