问题
I'm trying to export layers as files, but the script in photoshop exports layers as pngs including all of the empty space. Is there another script that allows for trimming layers before exporting?
回答1:
Select "Trim Layers" before exporting your files. By default, Photoshop supports trimming when exporting to PNG format using the script.
Optionally, if you want to export to JPEG, you can look into the script below.
Export Layers to Files with trim jpeg support

回答2:
Use Photoshop Generator.
- Add ".png" to layer name. (For more than one layer use Layers Rename script https://dl.dropboxusercontent.com/u/25518255/Layers%20Renamer.jsx)
- Check that Generator Enabled. (Edit -> Preferences -> Plug-ins)
- File -> Generate -> Image Assets
- Save
回答3:
I tried to use the following script in CC 2015 and for JPGs it works, but not for PNGs. For PNGs, the whole transparent artboard is part of the file, regardless of transparency settings. but is trimmed off for JPEG.
Obviously the 'trim' function DOES work in some cases, but the script may need some tweaking for Photoshop CC 2015.
Props to Naoki Hada, Tom Ruark, and Jeffrey Tranberry for the script. Link to the thread here: https://forums.adobe.com/thread/1639513
ALSO - another way to do I just learned is as the first commenter mentioned - using the Generator prefixes and suffixes on your groups.
Here's a good primer: http://www.maderalabs.com/?p=1249
来源:https://stackoverflow.com/questions/21552200/save-layer-to-file-and-trim