How to prevent image cropping when using Generate->Image Assets?

I have few layers in Photoshop, which I export using generator.
They have similar output options

28 x 28 green-led@1x.png, 56 x 56 green-led@2x.png

only difference is file name. However, one of the layers have transparent areas around and being cropped. This is not what I want. I want it to be exported with transparent areas.

Is there any way to achieve it with generator?

enter image description here

Exported fine

enter image description here

Cropped

enter image description here

Expected

enter image description here

Answer

Since that layer doesn’t have that low opacity area all the other ones have, you need to use a Layer Mask to define the bounds instead.

How can I get layers and groups that bleed off the canvas to appear as complete assets?

Set configuration options clip-all-images-to-document-bounds and clip-all-images-to-artboard-bounds to false via a Generator Config file. Assets that extend beyond the dimensions of the canvas will now be exported at their full size.

To selectively create an asset that is cropped to the canvas with the above options set, Select -> All then create a mask for the asset’s layer or group. The bounds of the mask will be used to determine the output dimensions of the asset. Keep in mind that a group mask will not affect that group’s children without the include-ancestor-masks option enabled.

Attribution
Source : Link , Question Author : Michael , Answer Author : Community

Leave a Comment