Jump to content

Inaccurate SVG export

Recommended Posts

I have a feeling this is due to AD's "Expand Stroke" not being overly optimized at the moment. Attached is an example of two different ways of creating that circle like you have for the search icon. First way uses two circles which the inner circle is subtracted from the other; notice there are four points on the outside and the inside. It's very clean.


The second process is creating a circle, then using Stroke > Expand Stroke. After expanding, there are a huge amount of nodes on the paths. Looking at your attachments, it looks like you are creating your objects from lines and then expanding (noticing it from the search icon handle).


So, until the expand stroke feature of AD is optimized better, I would either create the SVG export as either the line with a stroke amount (don't expand it, like you did with the handle), or use the boolean operators for cleaner nodes.


Share this post

Link to post
Share on other sites

By the way, if this is the issue, and you need thickness on the handle as well, you just need to think slightly different when creating the objects for svg optimization. Also attached is creating the handle like yours, by creating the shape with "Rectangle with round edges" (in the tool palette), you can customize the amount of curve on your box (handle). Then just boolean (subtract) an amount and put it in place.


The advantages of this way of doing it is when you're scaling the object, it maintains it's proportions. While using lines with strokes does not, i.e. draw an object with lines, put a stroke on it to give it thickness, then scale that object. You'll notice that the thickness will stay the same when scaling it, breaking consistency.


Also attached is my version of the search icon with the examples, and the final svg output for you to compare. One thing to look at is the file size of the svg of mine versus yours. search-icon.svg is weighing in at 1,019 bytes (1kb), and I have a feeling yours will be 3-6x in file size due to all the extra data (nodes). You can open svg's in any text editor to compare as well.




Share this post

Link to post
Share on other sites

I'm not sure if this is related, but when I create a circle in AD, or any paths that is curving, it starts of with few nodes, and when I export it to SVG, it gets lots of nodes as you can see in the attached pictures.


https://www.dropbox.com/s/ljb9s1cmk322211/Skjermbilde%202015-10-09%2010.28.12.png?dl=0 (4 nodes)

https://www.dropbox.com/s/yx4ezmswm4yyo5g/Skjermbilde%202015-10-09%2010.28.21.png?dl=0 (Many nodes)

Share this post

Link to post
Share on other sites

I tried to set stroke alignment to centre, but it's still is the same.

But if I expand stroke it uses much fewer nodes on export.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now