Created
January 19, 2024 16:12
-
-
Save Anenth/98d9c4b01d6b259c6534bf103627474c to your computer and use it in GitHub Desktop.
Convert all the svg to png
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install ImageMagick if not already present | |
if not command -sq magick | |
echo "Installing ImageMagick..." | |
brew install imagemagick | |
end | |
# Set the path to the folder containing SVG files | |
set svg_folder ~/Downloads/path | |
# Loop through each SVG file in the folder | |
for svg_file in $svg_folder/*.svg | |
echo "File: $filename.png" | |
# Extract the filename without extension | |
set filename (string split -r -m1 '\.' $svg_file)[1] | |
# Convert the SVG to a 256x256 PNG file | |
magick convert $svg_file -resize 256x256 $filename.png | |
# Print the filename | |
echo "Converted $filename.svg to $filename.png" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment