Skip to content

Instantly share code, notes, and snippets.

@Anenth
Created January 19, 2024 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Anenth/98d9c4b01d6b259c6534bf103627474c to your computer and use it in GitHub Desktop.
Save Anenth/98d9c4b01d6b259c6534bf103627474c to your computer and use it in GitHub Desktop.
Convert all the svg to png
# 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