16

I have a group with a transparent rectangle as the background, I'd like to export the group, make the exported png the same size as the background rectangle.

but sketch automatically trims my transparent pixels.

This is the layer hierarchy:

enter image description here

The Rectangle 6 is transparent and of size 50 * 50, the star 12 is in solid color and has a size of 32 * 32, I'd like to export this group as a 50 * 50 png.

I am using sketch version 3.2.2.

20

Got 2 answers for you...

  1. Select Rectangle 6 and click on make exportable, now click Create Separate Slice Layer (the little knife) and simply drag the shown image to your desktop to export it.

Answer 1

  1. (The better answer) Instead of using a transparent rectangle, create an Artboard. Hit A and drag a 50x50 box. Add your star, select the Artboard and click Make Exportable and finally drag the shown image to your desktop.

Answer 2

  • Second is not very clear. Where is Make Exportable? – atilkan Oct 22 '15 at 17:20
  • The slice method should work, try using the export button on the lower right instead of dragging the image. For the second method, I think huphtur miswrote, what you need to click is "export artboard 1" which you can see on the right hand corner – spiral Dec 14 '16 at 7:05
  • @atilkan have you even tried to export the artboard? It works, it keeps the transparent pixels. – Summer Dec 14 '16 at 8:40
  • @JaneDoe1337 don't even bother to answer after 1.1 year. I figured out somehow. – atilkan Dec 17 '16 at 1:24
  • @atilkan if you don't mark your question as answered it gets brought up after a certain period so people can try and answer it still. You're not the only one who can benefit from an answer or comment. – Summer Dec 19 '16 at 10:52
3

Alternative and simple solution:

Change de border Thichnkess to 0.01px or something below, and when exports, the outline is not rendered.

enter image description here

It works.

enter image description here

  • 1
    Toño Guerrero's | 0.01 border thickness solution worked well for me, because it will not create unwanted artboards and slices. – Prabaharan CS Sep 20 '16 at 11:45
  • Doesn't work perfect for me – 0.01 border produces barely visible outline. You can see it when using Magic Wand in Photoshop. – Pavel Alexeev Jan 25 '17 at 21:54
1

This might be too old but it can help others..

According to the answer of @spjpgrd , this option will appear if you put your layer out of any artboards.

Here is how i did it

0

The artboard method is the way to go.

If you already have that 50x50 transparent rectangle, if you select the group and press "A" to create a new artboard, the first option on the right-hand side is "Around Selection." Super handy.

enter image description here

  • That option doesn't appear. – atilkan Oct 22 '15 at 17:19
0

Do the following:

  1. Select layers to export
  2. Press Layers -> Flatten to Bitmap
  3. Drag bitmap from left list to the desktop
0

Select group 1star, then make right click on it, select Create Symbol, then go to Symbols page, select artboard with your new symbol and setup export settings on right panel - this workflow works as simple artboard for every group, but is powered by Symbols reuse feature.

0

For me as a developer who received ready sketch file, the fastest way is to open image in Photoshop, go to 'Image → Canvas Size', change the size and save it.

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!

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.