I am using the script inbuilt in photoshop, but if some of my layers work are outside canvas, it trims those to the visible area only.
But we need everything in the layer in png, whether is was visible in canvas or it is outside.
Best, Gunjan
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI am using the script inbuilt in photoshop, but if some of my layers work are outside canvas, it trims those to the visible area only.
But we need everything in the layer in png, whether is was visible in canvas or it is outside.
Best, Gunjan
I have got the answer from Adobe.
You can append appDocument.revealAll().
Also you can take the snapshot of the same before revealing all and then restore the snapshot. Below is the function you can copy in exporting all layers to file. Then call the takeSnapshot(); first then appDocument.revealAll(); in the start of the main.
and in the end call restoreSnapshot(); to bring it to the same position
function takeSnapshot () {
var desc = new ActionDescriptor();
var sref = new ActionReference();
sref.putClass(charIDToTypeID("SnpS"));
desc.putReference(charIDToTypeID("null"), sref);
var fref = new ActionReference();
fref.putProperty(charIDToTypeID("HstS"), charIDToTypeID("CrnH"));
desc.putReference(charIDToTypeID("From"), fref );
executeAction(charIDToTypeID("Mk "), desc, DialogModes.NO );
};
function restoreSnapshot(){
var doc = app.activeDocument;
var hs = doc.historyStates;
for(var a =hs.length-1;a>=0;--a){
if(hs[a].snapshot) {
doc.activeHistoryState = hs[a];
break;
}
}
};