Skip to content

Instantly share code, notes, and snippets.

@moluapple
Created February 2, 2012 03:26
Show Gist options
  • Save moluapple/1721220 to your computer and use it in GitHub Desktop.
Save moluapple/1721220 to your computer and use it in GitHub Desktop.
[Indesign] ResizeImage_BT_PS
// 调用PhotoShop按照Indesign中尺寸修改图像大小
Main();
function Main() {
var image = app.selection[0].images[0];
var imagePath = image.itemLink.filePath;
var hScale = image.horizontalScale;
var vScale = image.verticalScale;
CreateBridgeTalkMessage();
function CreateBridgeTalkMessage() {
var bt = new BridgeTalk();
bt.target = "photoshop";
bt.body = myResizeImage.toSource() + "('" + imagePath + "'," + hScale + "," + vScale + ");";
bt.send();
}
}
function myResizeImage(imagePath, hScale, vScale) {
var myFile = new File(imagePath);
var myDoc = app.open(myFile);
myDoc.resizeImage(myDoc.width.value * hScale / 100, myDoc.height.value * vScale / 100, 300);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment