web.svg.min icon indicating copy to clipboard operation
web.svg.min copied to clipboard

Consider trimming whitespace

Open alecmev opened this issue 8 years ago • 1 comments

Not sure how others use SVG assets, but in my case, I had to trim the whitespace myself, so that the width / height of an image would correspond to the same width / height of its contents. Handy way to trim the whitespace is to just open an SVG image in any browser, run this in the console:

const x = document.getElementsByTagName("svg")[0].getBBox();
console.log(`${x.x} ${x.y} ${x.width} ${x.height}`);

And copy the output into viewBox attribute of the SVG tag.

alecmev avatar Aug 19 '16 14:08 alecmev

I've added the whitespace by design because then I get consistent layout of icons but it could prolly be a good idea to remove it to be more flexible in terms of use cases.

larsenwork avatar Aug 22 '16 09:08 larsenwork