Advertisement


Photoshop - how to save just one layer?


Question

I guess many webmasters create layouts in Photoshop before coding, my layouts are full of different elements, buttons, icons, headers etc.

When I need to save a icon, I'm selecting it on layers list, right clicking, Duplicate, New, and here we are... The newly created tab with my icon has dimensions of the whole layout, not the icon, so when I'm having 1680x1050px layout and 20x20px icon then I'm getting 1680x1050 file with small icon in the middle, or somewhere else, and I have to drag the item to upper left corner of new image and cut the rest (I use crop tool usually).

Is there another way to save each layer (mostly rasterized) as a .jpg/.png transparent file without all this cropping? Or just open duplicated elements in new "tabs" with proper width/height?

2013/12/31
1
3
12/31/2013 7:36:00 AM

There are several ways to do this. See this question for a good description of using the slice tool.

For your workflow, record an action by doing this:

  • Select the layer.

  • Start recording.

  • Ctl/Cmd-click on the layer thumbnail in the Layers panel. This will select just the actual pixels in the layer, ignoring the transparency.

  • Copy Merged (Ctl/Cmd-Shift-C).

  • File > New

  • Click OK (defaults to "from clipboard" with the dimensions of what was copied).

  • Paste.

[OPTIONAL]

  • Save for Web

  • In your original window, deselect.

[/OPTIONAL]

  • Stop recording.

If you included the Save for Web step, be sure to click the empty box in the Actions panel to turn on the SfW dialog when the action is run.

At this point, you can target any layer and run the action, creating a new document with the exact dimensions (and transparency) of the contents of that layer.

For extra credit, you can include a "Drop down one layer" step using the keyboard shortcut at the end of the action, so you can work your way down a PSD by targeting the top layer then just repeatedly hitting the F key you assigned to that action until you get to the bottom.

2017/04/13
4
4/13/2017 12:46:00 PM