Convert and resize SVG to PNG

This is the way I do it and it seems to work. convert -background none -density 1000 -resize 1000x compass.svg compass.png Here’s what each part does. Use -background none to make sure any transparent parts of the SVG stay transparent and not get filled with white. As ImageMagick only works with raster images you need … Read more

How is the getBBox() SVGRect calculated?

People often get confused by the behavioral difference of getBBox and getBoundingClientRect. getBBox is a SVG Element’s native method as equivalent to find the offset/clientwidth of HTML DOM element. The width and height is never going to change even when the element is rotated. It cannot be used for HTML DOM Elements. getBoundingClientRect is common … Read more

How to cut a hole in an SVG rectangle [duplicate]

You should be able to use the fill-rule: evenodd(default) property to achieve this effect, if you want to prevent the fill of the rectangle from painting where the circle is. See this example from the SVG specification: The key point is draw outer shape and inner shapes(holes) in different direction (clockwise vs anti-clockwise). Draw the … Read more

How to make stroke width immune to the current transformation matrix

Edit: There is an attribute you can add to your rect to get exactly this behavior: vector-effect=”non-scaling-stroke” This was wrong: This will work if you apply the transform directly to the shape, not the group it is in. Of course, if you wanted to group several items and scale them all together, that approach won’t … Read more

Is there a trick to display svg images in gmail?

Google Gmail does not support SVG at this time. Google Gmail Support said that they will not support it last time i contacted them. Maybe some time in the distant future when SVG becomes more popular and widely used. Check out this article: http://stylecampaign.com/blog/2014/01/basics-of-svg-in-email/ And this PDF: http://stylecampaign.com/blog/blogimages/SVG/QA-SVG-in-email.pdf Also see this SO question: SVG images … Read more