script-convert-png-to-svg-using-imagemagick
Here is a simple script to convert a folder of png files to svg files. In order to run this script, you will need to install ‘imagemagick’ and ‘potrace’. I used brew to install both;
brew install imagemagick and brew install potrace should do the trick. Don’t forget to make the script executable with chmod +x.
#!/bin/bash
input_folder="/path/to/png/folder"
output_folder="/path/to/svg/folder"
for file in "$input_folder"/*.png; do
filename=$(basename "$file" .png)
output_file="$output_folder/$filename.svg"
convert "$file" -background none -transparent white "$output_file"
if [ $? -eq 0 ]; then
echo "Converted $file to $output_file"
else
echo "Failed to convert $file"
fi
done