SVG to ICO with transparent background

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Lukas
Posts: 2
Joined: 2018-03-10T01:58:23-07:00
Authentication code: 1152

SVG to ICO with transparent background

Post by Lukas »

Hello,
I would like to convert my svg image to multi-resolution ico file. Svg image is created in the inkscape and has transparent background.

I tried many options to convert, but background is always white.
I found several topics related this problem, but no one helped me...

Here is my command:

Code: Select all

convert zTest.svg -background none -define icon:auto-resize="256,128" zTest.ico
I also tried add/change -alpha on, -alpha set, -background transparent, etc.

I run this script on Windows 10, ImageMagick-7.0.7-25.

Can you help me, please?

Best regards
Lukas

and the source svg:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   version="1.1"
   x="0px"
   y="0px"
   width="256"
   height="256"
   viewBox="0 0 256 256"
   enable-background="new 0 0 52 52"
   xml:space="preserve"
   id="svg49"
   sodipodi:docname="zTest.svg"
   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"><metadata
     id="metadata55"><rdf:RDF><cc:Work
         rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
     id="defs53" /><sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:window-width="1680"
     inkscape:window-height="987"
     id="namedview51"
     showgrid="false"
     inkscape:showpageshadow="false"
     inkscape:zoom="1.8218036"
     inkscape:cx="110.81695"
     inkscape:cy="159.68965"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1"
     inkscape:current-layer="svg49"
     inkscape:pagecheckerboard="true" /><path
     style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;vector-effect:none;fill:#f26311;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.2741873;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:normal;enable-background:accumulate"
     d="M 128,16.741651 C 66.362874,16.741651 16.74165,66.362874 16.74165,128 16.74165,189.63713 66.362874,239.25835 128,239.25835 189.63712,239.25835 239.25835,189.63713 239.25835,128 239.25835,66.362874 189.63712,16.741651 128,16.741651 Z M 57.394,99.186899 H 198.606 V 155.38176 H 57.394 Z"
     id="rect817"
     inkscape:connector-curvature="0"
     sodipodi:nodetypes="sssssccccc" /></svg>
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: SVG to ICO with transparent background

Post by snibgo »

Try with "-background none" before the svg file, instead of after. Then the software that rasterizes the svg should use "none", ie transparent black, as the background.
snibgo's IM pages: im.snibgo.com
Lukas
Posts: 2
Joined: 2018-03-10T01:58:23-07:00
Authentication code: 1152

Re: SVG to ICO with transparent background

Post by Lukas »

You are the best, snibgo!
Thanks a lot.
Have a nice weekend.
Post Reply