Sg2.9
Troubles with Item.rasterize(...
Recent RSS
Troubles with Item.rasterize(), selected
From:  Jirka
Date:  2. August 2012, 17:13

Hi,

I am trying to make a simple script that would save all my layers to multiple files (an equivalent to the similar script Photoshop has). But the console keeps yelling at me Can't find method com.scriptographer.ai.Item.rasterize(com.scriptographer.ai.ItemList,string) message all the time.

var layers = document.layers;
for (var i in layers) {
	var layer = layers[i];
// Select all
	for (var i in layer.children) {
		layer.children[i].selected = true;
	}
var buffer = layer.rasterize(layer.children, "cmyk");
	Packages.javax.imageio.ImageIO.write(buffer, "jpg", new java.io.File("/test.jpg"));
}

Also, two more questions:
– Is it always required to list layer's children in order to get the layer selected? The Layer.selected parameter is described in the Reference as inherited...

layer.selected = true; // throws an error

– What about the Java stuff in the last statement? I got it from this forum and it seems to be incorrect too.

Can you help me out?

Jirka

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Abstract Foliage 18.08.08