Respect user defined bounds if defined #145

timriot opened this Issue Aug 23, 2013 · 13 comments


None yet
10 participants

timriot commented Aug 23, 2013

Requested by @subtleGradient:

Regardless of transparency,
crop assets based on the following…

it = The Layer whose Bounds you're trying to figure out.

If it is a layerSet (group) and has a child whose name is "@bounds", determine the bounds based on the "@bounds" layer instead.

If it has a vector mask, use those bounds, regardless of transparency.

If it has a bitmap mask, trim away all 100% transparent mask pixels, ignoring all other channels.

If it is a layerSet (group) and has no masks, combine the bounds of all visible descendant shape layers (regardless of the transparency of their rasterized pixels) plus all visible pixels.

timriot commented Aug 23, 2013

Related to #40

My name is Thomas Aylott, and I approve this bug report.

g12n commented Sep 9, 2013

Yes! This behavior would mimic quite nicely the naming conventions of Slicy. see

kimroen commented Sep 10, 2013



DennisKehrig commented Sep 18, 2013

@timriot What if there are multiple children named @bounds? What if @bounds is in layer set A and layer set A is in layer set B and layer set B gets exported?

Options are some kind of precedence rules, or combining the bounds (like the smallest rectangle wrapping all bounds). We could also ignore children to allow parents of a parent to overwrite their children's bounds (then a child set could have bigger bounds than the parent set).

g12n commented Sep 18, 2013

My Guess for this problem:

If a layer set contains more than one @bounds:

  • only the upper @bounds element is used
  • the lower one is hidden from the export

If a layer set contains subfolders containing @bounds:

  • the @bounds are in the subfolder get ignored
  • these bounds are used only, if the subfolders get exported

Slicy puts multiple Exports into a folder called @clices to export multiple slices of a layer set at once.
Maybe a similar solution would be nice as well.


But most important for a start is the request to use the layer mask of a layer as bounds regardless of its transparency:


timriot commented Dec 10, 2013

We've got the layer mask. How important is @bounds functionality, @subtleGradient?

@timriot @subtleGradient
I'm really glad the layer mask was implemented, that is something I had to use Slicy for while generator couldn't handle that. Hoping though that vector masks will be recognized too, while bitmap layer masks get the job done, it requires an extra step of unlinking to resize them and are more prone to pixel blurring along the edges. For me the @bounds feature of Slicy is really nice, while it essentially does the same thing as a layer mask, the advantage is that it allows you to visually compare your transparent padding around the icon more effectively and since it ignores the layer you don't accidentally export it with a colored background :) so it works well for my workflow, currently I often use a "bounds" layer and make the edits to that and then reapply it's selection as a layer mask and turn that layer off, takes a few more steps but allows me to see the spacing more effectively.

screen shot 2014-02-06 at 8 24 23 am

timriot commented Feb 7, 2014

@adamdiestelkamp you make a great point. I would have loved to have had both @bounds and layer/vector mask, but resource constraints kept that from happening. @joelrbrandt, let's consider @bounds functionality and support for vector masks in our next release.

@timriot @joelrbrandt I'm working on a project and jumping back to using Slicy for this portion because it handles exporting one layer set as multiple images defined by @slices folder (like @mi1980ge already mentioned). I'm exporting individual letters from a scanned in sheet of paper (for a custom font) and I can keep my psd file size more minimal and keep the workflow more efficient and flexible (i'm making 3 of these fonts using the same process) by cutting up the scanned image rather than creating a separate image layer for each letter. So adding a bump for the @slices feature down the road :)

@adamdiestelkamp That's a separate feature. Can you add a new GitHub issue for tracking @slices support?

@joelrbrandt joelrbrandt modified the milestones: PS 15.0, PS 14.2 FC Mar 7, 2014

@iwehrman iwehrman removed this from the PS 15.0 milestone Mar 7, 2014

theo-v commented Mar 22, 2014

Layer masks don't work well — too much clicking around, especially for editing, vector masks are preferred, Slicy's "@bounds" or Cut&SliceMe's "#" transparent layer seem to work well too.

+1 for @bounds layer. It would be very useful for all kind of exports (png, jpg, svg)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment