Skip to content

Instantly share code, notes, and snippets.

@Serifenlos
Forked from moluapple/gist:1721220
Created February 8, 2016 11:36
Show Gist options
  • Save Serifenlos/eb4f0dc6db8db1e5f232 to your computer and use it in GitHub Desktop.
Save Serifenlos/eb4f0dc6db8db1e5f232 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