var fileRef = new File(app.path.toString() + "/Samples/test.jpg"); // 'samples' is a folder resides in Program Files\Adobe\Adobe Photoshop CS5\samples 
 //open (fileRef);
 
 var doc = open(fileRef);
 
 // get document name (and remove file extension)
 
 var name = tempName[0];
 
 // convert to RGB; convert to 8-bpc; merge visible
 
 doc.changeMode(ChangeMode.RGB);
 
 doc.bitsPerChannel = BitsPerChannelType.EIGHT;
 
 doc.artLayers.add();
 
 doc.mergeVisibleLayers();
 
 // rename layer; duplicate to new document
 
 var layer = doc.activeLayer;
 
 layer.name = tempName[0];
 
 layer.duplicate(newDoc, ElementPlacement.PLACEATBEGINNING);
 
 // close imported document
 
 doc.close(SaveOptions.DONOTSAVECHANGES);
 | 
 
 
 
 | 
No comments:
Post a Comment