Tag Archives: Command Line

Introducing the Command Bar →

Steve Smith:

At GitHub, we use the command line every day. From git commands to script/server, we love the power it offers. This got us thinking, “why can’t we do that with github.com?”

You can use the Command Bar to follow people, browse repositories and issues and much more. Great feature.

Quickly convert SVG graphics into PNG images

Sometimes I use icons from The Noun Project in layouts, documents or presentations. You can only download the icons in SVG format which is great because you can scale them as you like. However you need to convert them into another format before you can use them. Since even Photoshop is not able to open SVG files I always need to start Illustrator to convert them into PNG. I thought there must be a better solution.

Once again help is provided by the Terminal. First you need LibRsvg, which is easy to install if you have Mac OS X and Homebrew already installed:

brew install librsvg
Update 29th of July:
At least since version 2.36.1 the name of the command is now rsvg-convert instead of rsvg. I update the article to reflect this change. However, if you want to continue to use rsvg (since it is shorter) you can create a symlink:

ln -s /usr/local/bin/rsvg-convert /usr/local/bin/rsvg
Update 9th of November:
You know have to use the parameter -o to specify the output PNG file. I updated the article to reflect that. Thanks Tim.

Now you can use the rsvg command line tool. For example, to convert noun_project_836.svg into a PNG file with 200px width you can do:

rsvg-convert -w 200 noun_project_836.svg -o noun_project_836.png

You can also provide the required height of the output image:

rsvg-convert -h 200 noun_project_836.svg -o noun_project_836.png

As long as you only provide width or height the other dimension will be scaled accordingly. If you provide both width and height the resulting image will have exactly the given dimensions:

rsvg-convert -w 200 -h 200 noun_project_836.svg -o noun_project_836.png

That’s it. Super simple SVG to PNG conversion.