
这段时间一直在ps中批量处理图片,有时需要将每个图层里的图片分别导出到jpg或其它格式的图片,如果用ps自带的“将图层导出到文件”脚本,那么导出的图片名会带下划线及数字,这可能是考虑到重复名字的问题,但是大多数时候,我想要的就是单纯的图层名字,不带任何修饰。于是在网上搜了一圈,最后在一个英文网站里找到了答案。下面两个文件分别是导出脚本的修改版和原版,修改版可以让导出的图片名字和图层名字一样。
下载地址:
修改版: Export Layers To Files (no numbers) (不带数字)
下载后将文件解压到Adobe Photoshop CC (64 Bit)\Presets\Scripts 下面即可,红色的是ps根目录,总之找到你电脑中ps的根目录,cs5,cs6,cs7(cc)肯定都可以的
有些低版本如果下载上面的不起作用,可以去研究下,有问题可以留言或联系我
http://graphicdesign.stackexchange.com/questions/10669/cs5-export-layers-as-files-no-number-sequence
重点几行如下:
- on Mac running Lion, goto
Applications > Adobe Photoshop CS5 > Presets > Scripts > Export Layers To Files.jsx
(in windows it's pretty much the same directory just in "program files/Adobe" - Now in this file goto line 1030 and comment it out.
- Also in line 1031, change
fileNameBody += "_" + layerName;
tofileNameBody += layerName;
deleting the underscore and parenthesis. - Comment out line 1049 (fileNameBody += "_" + zeroSuppress(i, 4) + "s";)
- Save
--------------------
后来遇到的另一个问题,本人经常要导出指定背景的图层文件,搜遍全球网络没发现一个高效的解决方法(可能有些英文版的没看到),经过牛牛的摸索,终于解决了,只需更改第917行开始的函数至如下代码即可,从原理上讲是因为,背景层是脚本统计的最后一个层(数字最大),而只要不要去统计最大的那个层(就可以了,不让最后层隐藏,也就同时输出了)!
function setInvisibleAllArtLayers(obj) {
for( var i = 0; i < obj.artLayers.length-1; i++) {
obj.artLayers[i].allLocked = false;
obj.artLayers[i].visible = false;
}
for( var i = 0; i < obj.layerSets.length-1; i++) {
setInvisibleAllArtLayers(obj.layerSets[i]);
}
}
分享地址: Export Layers To Files(with backgound color and no number).zip
http://url.cn/QYktQ4