Created
May 19, 2010 01:27
-
-
Save kanemu/405831 to your computer and use it in GitHub Desktop.
[indesign][extendscript]画像の幅と高さを取るサンプル、画像をフィットさせるサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
fitimage_ind.jsx | |
画像の幅と高さを取るサンプル | |
画像をフィットさせるサンプル | |
※ピクセルサイズを取るのはInDesignでは無理 | |
*/ | |
//画像の入ったフレームを選択 | |
var sel=app.activeDocument.selection[0]; | |
//中の画像 | |
var img=sel.allGraphics[0]; | |
//プロパティ全部確認 | |
//$.writeln(img.properties.toSource().replace(/,/g,",\n")); | |
var bounds=img.geometricBounds; | |
var w=(bounds[3]-bounds[1])/img.horizontalScale*100;//幅 | |
var h=(bounds[2]-bounds[0])/img.verticalScale*100;//高さ | |
$.writeln('W:'+w+',H:'+h); | |
img.fit(FitOptions.PROPORTIONALLY); | |
/* | |
FitOptions.CENTER_CONTENT | |
FitOptions.CONTENT_TO_FRAME | |
FitOptions.FILL_PROPORTIONALLY | |
FitOptions.FRAME_TO_CONTENT | |
FitOptions.PROPORTIONALLY | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment