Generating all the icons you need quickly from SVG files - SVGtoIcons

The SVGtoIcons project that I mentioned a couple of posts ago is now in a reasonable state for use by others. I've just added documentation that should make it fairly easy to use.

What is it?

A simple script of less than 150 lines of commented Ruby that use Inkscape to convert SVG files into all the sizes of bitmap (png) that you need. It was written primarily to help me complete the release of Fast Lists 2.0. Inkscape is a nice free (and Free) tool but the export UI made it annoying to create lots of different size bitmaps and I didn't know of a good way to do minor non-destructive changes to the shape of the page that you want to output keeping the drawing centred. This script makes it easy.

While I created it to help with iOS app icons and launch screens it can be used for any particular size outputs. When I use it I generate a couple of icons used within Fast Lists in addition to main App Icons and launch icons.

Why should I care?

Well if you have a designer to create every icon from scratch for each size (iPad, iPhone, portrait, landscape, retina, non-retina and for each context it is used in) then maybe you don't need this. But if you have to create the icons yourself generating them from Scalable Vector Files should produce better results than resizing bitmaps. This helps you do that process quickly.

How do I use it?

The documentation I've put on Github is pretty reasonable now so that is the place to go for details including details of the main functions that you can use from your own script or in the REPL (e.g. irb).

The first thing that you need is your SVG files set up with appropriate 'page' sizes that include all the content that must be included. You can have a bigger design to control the output when the shape of the output is going to be different. In the default setup a fairly square image is probably generally the best although you can easily customise it to use more images if you want to use different images for portrait and landscape. The script will aspect fit and centre the page that you set into the output png's it creates

If you are simply using one SVG for an iOS app icons and another for the iOS launch images that you want all you need to do is to put those files in the test_files folder named `test_icon.svg` and `test_file.svg` and run the script: `./svgtoicons.rb`. Then look in the `output_files` folder to see the created files with names indicating their sizes.

If you want to customise the source is in a pretty good state and it should be reasonably clear what you need to change (if not get in touch).

License - GPLv2

I've selected the GPLv2 for this project as a tribute to Inkscape itself. While this script is NOT a derivative work of Inkscape in my view as it only uses the public interface and it would not be hard to drop in an alternative software or library as only two calls are made to Inkscape itself. This means that if you would like this under a different license you can get in touch with me.

Get in Touch

If you use it or have suggestions please let me know either through Github, a comment here or directly by email.