Skip to main content
  1. posts/

Mass Converting .svg to .png on macOS

·180 words·1 min·
Christian Mohn
OS X Blogtober Homebrew macOS
Author
Christian Mohn
IT veteran, podcaster, author, and blogger from Bergen, Norway.
Table of Contents

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.

Related

Making Royal TSX Even More Awesome
·657 words·4 mins
Christian Mohn
OS X Software Awesome Blogtober management RoyalTSX Software
macOS: Spectacle
·88 words·1 min
Christian Mohn
OS X Software macOS Recommended Spectacle
macOS: Secure Pipes
·109 words·1 min
Christian Mohn
OS X Software macOS Proxy SSH Tunnels