15

Using Sketch 3 want to export an icon, the icons themselves are 24x24 but they sit within an area of 32x32.

I've figured out how to do it by combining two different layers one 24x24 and the other 32x32 but it's a tedious process. I need to do this for every single icon.

Is there a faster workflow?

  • 1
    can you clarify what you mean by "an area"? A solid color? An artboard? A slice? Or do you just need the final file to be 32x32 with the 24x24 icon within it? – spiral Dec 4 '14 at 8:32
  • Hi Ariel, welcome to GDSE and thanks for your question. Please clarify what your problem is, as Spiral asks. If possible, please post an example picture. Thanks! If you want to know more about the site, please see the help center or ping one of us in chat once your reputation is sufficient (20). Keep contributing and enjoy the site! – Vincent Dec 4 '14 at 11:22
13

Hit A to create an Artboard, select the size (or set your own by clicking the + in the bottom right) and start exporting. No need to create extra layers.

7

It's actually very easy if you know how to do it :)

Suppose you have an icon that is 24x24px and you want the png to be 32x32px. You have to create a slice over the icon. The slice must be 32x32px. Then group the slice and the icon together. Last but not least: click on the slice and in the inspector you will see something like this:

Inspector Window

Make sure you check "Export Group Contents Only". The other options must be unchecked.

This way, you will export a transparent png, even if there isn't a transparent background under the icon.

  • I don't have theses options, will be deprecated? I am using Sketch version 56.2 – Adriano Resende Jul 31 at 18:38
1

If you want to export only the icon layer (24x24) just drag the layer to the desktop.

  • Would be nice. Unfortunately you will not have icons for higher screen resolutions. – Julian F. Weinert Jul 21 '15 at 12:32
1

Use this to export your assets. The issue with Sketch itself and most other plugins is that it neglects invisible layers while exporting. As a result, invisible bounds do not work.

I even tried to decrease a bound's opacity to 0 so to try to trick Sketch into exporting it. But Sketch's native export isn't so naive.

You might see a horde of plugins of Sketch that help in exporting assets for Android easily. They might reduce the steps involved, but it doesn't solve the bounds problem.

This one does.

https://github.com/GeertWille/sketch-export-assets

It allows you to export assets for iOS, Android and Windows for all resolutions while keeping the bounds intact.

Saves all that artboard efforts.

  • 1
    Hi Sarthak, could you please explain a bit more what we'll find behind the link you provide and why it answers the question? That way, your answer is still of value in case the link breaks at a later time. Link rot is the main reason we really dislike link-only answers here. Thanks for your effort and keep contributing! – Vincent Jul 8 '15 at 13:43
0

This method worked for me: Place the correct size slice layer above the layer your icon is on and make sure they are not grouped.

Hope it helps

enter image description here

0

I spent more time than it would have taken manually to go one by one but I did not give up and found a solution that works well:

  1. Copy all icons you wanna export to a new file
  2. Convert them to symbols
  3. Since they became symbols they will have their own artboards (you just need to double click one of the symbols to get to the symbols page)
  4. When on the symbols page make sure that all symbols are collapsed View > Layer list > Collapse all groups and select them all cmd+A
  5. Now you can go on and select make exportable end export them all
  6. Voila! If you named them properly you'll also have them in neat little folders

hope this helped!

0

I came up with a workaround not involving creating separate artboards. It's a little hacky, but it worked for me. I wanted icons within my design to be exportable in Zeplin. So making new artboards would make it more difficult for developers to find the icons.

So I made the square background 1% opacity with the blend mode "Darken". You can't see it at all. Then I grouped that with the icon and made the group exportable. Super simple.

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.