svg2ico converts SVG images into ICO images. It is written in Java, and is available as an Ant task. It is open source, and free for you to use.

The latest version of svg2ico available for download is 1.73. The javadoc is also available online.

The project is hosted on GitHub.

Downloads

Argo is available under the Apache 2 license. It can be downloaded in three forms:

  • a jar, with source code and shadowed dependencies included,

  • as a Maven dependency from Maven Central, using

<dependency>
    <groupId>net.sourceforge.svg2ico</groupId>
    <artifactId>svg2ico</artifactId>
    <version>1.73</version>
</dependency>

Previous versions are also available.

Command Line Example

svg2ico can be used from the command line to convert resources/favicon.svg to an ICO like this:

./svg2ico-1.73.jar -src resources/favicon.svg -dest favicon.ico -width 32 -height 32

Three additional optional arguments are supported. -depth specifies the colour depth in bits per pixel, e.g. -depth 8 outputs eight bits per pixel. The -compress flag causes the output to be compressed ICO format. The -userStylesheet allows a user stylesheet file to use during rendering to be provided, for example -userStylesheet ./my-style.css.

Ant Example

svg2ico can be used as an Ant task to convert resources/favicon.svg to an ICO like this:

<target name="Convert SVG to ICO">
    <taskdef name="svg2ico"
        classname="net.sourceforge.svg2ico.Svg2IcoTask"
        classpath="lib/build/svg2ico-1.73.jar"
    />
    <svg2ico src="resources/favicon.svg"
        dest="resources/favicon.ico"
        width="32"
        height="32"
    />
</target>

where lib/build/svg2ico-1.73.jar points to where the svg2ico jar can be found. As with the command line, three optional attributes are supported. depth specifies the colour depth in bits per pixel, e.g. depth="8" outputs eight bits per pixel. compress causes the output to be compressed ICO, e.g. compressed="true". userStylesheet specifies a user stylesheet to use for rendering, e.g. userStylesheet="resources/favicon.css".

Credits

svg2ico uses the excellent Batik and image4j, included in the distribution using the equally excellent Gradle Shadow plugin.