0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

vistaでphotoshop その10

Posted at

概要

vistaでphotoshopやってみる。
キャンバス作って、jpg読んで、範囲指定で赤、書いて、pngで出力やってみる。

写真

test9.png

サンプルコード

preferences.rulerUnits = Units.PIXELS;
var docObj = app.documents.add(640, 480);
var fileObj = new File("/Users/ore/eki.jpg");
open(fileObj);
activeDocument.selection.selectAll();
activeDocument.activeLayer.copy();
activeDocument.close(SaveOptions.DONOTSAVECHANGES);
docObj.paste();

var myColor = new SolidColor();
myColor.rgb.red = myColor.rgb.green = myColor.rgb.blue = 0;
myColor.rgb.red = 255;
var x = 100;
var y = 100;
var selReg = [[x, y], [x + 100, y], [x + 100, y + 100], [x, y + 100], [x, y]];
activeDocument.selection.select(selReg);
activeDocument.selection.fill(myColor, ColorBlendMode.NORMAL, 100, false);


var pngOpt = new ExportOptionsSaveForWeb();
pngOpt.format = SaveDocumentType.PNG;
pngOpt.optimized = true;
pngOpt.interlaced = false;
pngOpt.PNG8 = false;
var filePath = new File("/Users/ore/test9.png");
activeDocument.exportDocument(filePath, ExportType.SAVEFORWEB, pngOpt);
alert("ok");



以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?