2

I've made an icon which is 47 units wide. It has a border that is 3 units wide so I assume that the total is 50 units wide. Is my assumption wrong?

However, when I create a slice, the slice becomes 51 units wide. Why is that, and how can I make sure my slice is as big as its contents?

  • Both of those measurements seem wrong to me. I was expecting 53 units. 3 + 47 + 3, since your border would be on both sides of the icon (I assume it is, anyway?). – Manly Sep 21 '16 at 15:07
  • I guess he used 3px centered border, which would give him 50px, provided the graphic is aligned to the pixel grid. – Spasimir Dinev Feb 8 '17 at 13:43
  • @SpasimirDinev yes, exactly. – Anton Feb 9 '17 at 11:20
0

When you set up a rectangle of 47 and give it a centered border of 3, you're going to get your overall shape out of the pixel grid, consequently taking up more than 50px misaligned

You have two options: 1. align the rectangle to subpixels (if it was at 100, 100 position, make it at 100.5, 100.5 position), so it aligns back to the pixel grid realign

  1. create your icon at 50x50px and set the stroke to inner. make sure it's aligned to pixel grid. export.
  • I went for option 1 since this icon was a variation of another one (without a border) so it was easier to fix the alignment then to fix the border position. Thanks. (The issues was fixed quite a while ago, I just forgot to answer it.) – Anton Feb 9 '17 at 11:22
0

Select your icon and change it's outline position to center then export it.
It'll be exactly the size you are looking for.

enter image description here

  • This is not correct. Make a rectangle, with a border of thickness 1. Compare the export results when you set the border to be inner or center. The inner will have the same size as the rectangle. With center the exported rectangle will actually be larger. – Anton Nov 10 '16 at 10:30
  • @Anton in the screen shot above I've made size of rectangle to 56x56 and made it's border thickness to 4 with position center. When I exported it to PNG 1x it was the exact 60x60 size. – Chaudhry Talha Nov 10 '16 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.