Code: Select all
app.preferences.rulerUnits=Units.PIXELS;
app.preferences.typeUnits=TypeUnits.PIXELS;
var d = app.activeDocument;
var savedState = d.activeHistoryState;
d.resizeImage(2048,2048);
var pth=d.path.toString();
pth=pth.slice(0,pth.lastIndexOf("/")+1);
var fname=pth+"../textures_masks_gs/" +d.activeLayer.name+".png";
var fl=new File(fname);
fl=fl.saveDlg("Select path:");
var expOptions=new ExportOptionsSaveForWeb;
expOptions.format=SaveDocumentType.PNG;
expOptions.PNG8=true;
expOptions.includeProfile=true;
expOptions.ColorReductionType=ColorReductionType.GRAYSCALE;
expOptions.dither=Dither.NONE;
expOptions.webSnap=0;
expOptions.colors=128;
expOptions.transparency=0;
d.changeMode(ChangeMode.GRAYSCALE);
d.exportDocument(fl,ExportType.SAVEFORWEB,expOptions);
d.activeHistoryState = savedState;