This function places an image as a smart image into the active document. The resize() calll in there works around a problem if the ppis are not the same. After this you'll probably want to resize, translate, and rasterize the layer. -X function placeImage(file) { cTID = function(s) { return app.charIDToTypeID(s); }; sTID = function(s) { return app.stringIDToTypeID(s); }; var desc = new ActionDescriptor(); desc.putPath( cTID('null'), file); desc.putEnumerated( cTID('FTcs'), cTID('QCSt'), cTID('Qcsa') ); var ldesc = new ActionDescriptor(); ldesc.putUnitDouble( cTID('Hrzn'), cTID('#Pxl'), 0.000000 ); ldesc.putUnitDouble( cTID('Vrtc'), cTID('#Pxl'), 0.000000 ); desc.putObject( cTID('Ofst'), cTID('Ofst'), ldesc ); executeAction( cTID('Plc '), desc, DialogModes.NO ); var layer = app.activeDocument.activeLayer; layer.resize(100, 100); return layer; }
... View more