Mass Converting .svg to .png on macOS

Published by Christian Mohn · Read in about 1 min (179 words)

When playing around with Royal TSX I needed to mass convert the VMware Clarity .svg files to .png files that I could use as icons in Royal TSX.

After trying a series of different approaches, I ended up with using rsvg-convert from libRSVG. In order to get rsvg-convert installed on my MacBook, I turned to HomeBrew.

HomeBrew, which calls itself **The missing package manager for macOS **is in my opinion essential for any macOS user. If you are missing a command or utility, chances are that HomeBrew has you covered.

Mass Converting: #

Once you have HomeBrew installed, you’re pretty much ready to go by running the following command in Terminal:

brew install librsvg

This installs the libRSVG formulae, and all it’s dependencies, and makes rsvg-convert available.

Once libRSVG installed locally, you can mass-convert .svg files by running the following command in your terminal of choice.

for i in *; do rsvg-convert $i -o `echo $i | sed -e 's/svg$/png/'`; done

This loops through every .svg file in the current directory, and creates .png versions of them, for usage elsewhere.

Post last updated on January 2, 2024: Update copyright to 2024

About

vNinja.net is the online hub of Christian Mohn and Stine Elise Larsen.

The site primarily focuses on IT architecture and data center technologies, with a strong emphasis on virtualization and related topics.
While the main content revolves around these areas, you'll also find a range of other subjects covered from time to time, reflecting the interests of authors.

Sponsors