-
Notifications
You must be signed in to change notification settings - Fork 0
/
save.jsx
39 lines (34 loc) · 1.19 KB
/
save.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var width = 1280;
var height = 720;
var docObj = activeDocument;
activeDocument.resizeImage(width, height);
activeDocument.changeMode(ChangeMode.RGB);
activeDocument.embedColorProfile = false;
activeDocument.RemovePersonalInformation= true;
activeDocument.RemoveDateAndTime = true;
docObj.activeLayer = docObj.layers[1];
docObj.layers[0].visible = true;
docObj.layers[1].visible = false;
var titleArr = docObj.layers[0].layers;
for (i = 0; i < titleArr.length; i++) {
titleArr[i].visible = false;
for (j = 0; j < titleArr[i].layers.length; j++) {
titleArr[i].layers[j].visible = true;
}
}
docPath = activeDocument.path;
for (i = 0; i < titleArr.length; i++) {
titleArr[i].visible = true;
chap = ('00' + (i + 1)).slice(-2);
var fileObj = new File(docPath + "/" + chap);
var pngOpt = new PNGSaveOptions();
pngOpt.interlaced = false;
activeDocument.saveAs(fileObj, pngOpt, true, Extension.LOWERCASE);
titleArr[i].visible = false;
}
docObj.layers[0].visible = false;
docObj.layers[1].visible = true;
fileObj = new File(docPath + "/背景");
var pngOpt = new PNGSaveOptions();
pngOpt.interlaced = false;
activeDocument.saveAs(fileObj, pngOpt, true, Extension.LOWERCASE);