シネマスコープサイズの帯を作る

Photoshopで画像にシネマスコープサイズで黒い帯をつけるスクリプトです。

// http://www.openspc2.org/book/PhotoshopCC2014/

// ドキュメントの横幅、縦幅を調べる
// http://www.openspc2.org/book/PhotoshopCC2014/easy/document/004/index.html
preferences.rulerUnits = Units.PIXELS;
w = activeDocument.width;
h = activeDocument.height;
//

// シネマスコープサイズを計算
h2 = w / 2.35
//
if (h > h2){

// 範囲選択する位置を計算
y = (h / 2) - (h2 / 2)
y2 = (h / 2) + (h2 / 2)
//

// 座標を指定して選択する
// http://www.openspc2.org/book/PhotoshopCC2014/easy/selection/002/index.html
selReg = [[0,y],[w,y],[w,y2],[0,y2]];
activeDocument.selection.select(selReg);
//

// 選択範囲を反転させる
// http://www.openspc2.org/book/PhotoshopCC2014/easy/selection/009/index.html
activeDocument.selection.invert();
//

// レイヤーを作成する
// http://www.openspc2.org/book/PhotoshopCC2014/easy/layer/007/index.html
layObj = activeDocument.artLayers.add();
//

// 選択範囲を塗りつぶす
// http://www.openspc2.org/book/PhotoshopCC2014/easy/selection/010/index.html
RGBColor = new SolidColor();
RGBColor.red = 0;
RGBColor.green = 0;
RGBColor.blue = 0;

activeDocument.selection.fill(RGBColor,ColorBlendMode.NORMAL, 100, false);
//

// 選択を解除する
// http://www.openspc2.org/book/PhotoshopCC2014/easy/selection/003/index.html
activeDocument.selection.deselect();
//
}else if (h == h2){
beep();
alert("範囲選択を作成できません")
}else if (h < h2){
beep();
alert("画像の縦の比率が足りません")
}

動画は、上記スクリプトをPhotoshopのアクションから実行した時の動作です。

スクリプトの実行は“参照...”から
この動作をアクションに登録すればアクションから実行できます。

更新履歴

inserted by FC2 system