Photoshop - how to save just one layer?
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?
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.
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).
Save for Web
In your original window, deselect.
- 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.