How to generate ICO file from SVG using maven?

In my project, I need an icon file (.ICO) for the Windows executable. I would like to generate this file from SVG, so it contains several images for different sizes. Is there a maven plugin that can do this for me?

I know that I can just put the icon file in my repository, but the source file is an SVG image, so I would like to avoid this.

+4
source share
4 answers

I donโ€™t think there is any Maven plugin for this. And also the problem is a bit beyond maven itself.

What can you do:

+3
source

I came across your question, looking for a solution to a very similar problem. I didnโ€™t like any of the answers given, because I didnโ€™t want to get attached to executable files, so I wrote a clean Java Ant task (using Batik and image4j under the covers)

I opened it at http://svg2ico.sourceforge.net/ - maybe you could call it from Maven?

+2
source

You can rasterize SVG to PNG on a web page using Google canvg to paste it into the canvas, and then using toDataURL() on the canvas to get base64 encoded PNG data. Then you need to decode it.

Or you can use any number of server - side SVG-to-PNG converters .

Not a better answer than @ Andrey, but showing more options for the first step.

+1
source

batik-maven-plugin will at least allow you to generate PNG from SVG. Not sure how to create an ICO.

+1
source

Source: https://habr.com/ru/post/1342831/


All Articles