import javax.imageio.*;
import groovy.swing.j2d.*
img = ImageIO.read(new File("sf.jpg"))
gr = new GraphicsRenderer()
gr.renderToFile("sample952a.png", img.width,
img.height){
image(image: img)
rect(x:0, y:0, width: img.width,
height: img.height, borderColor:no){
texturePaint(x: 0, y: 0, image:img )
filters {
chromaKey(color: color("blue"),
hTolerance:0.15, sTolerance:0.8,
bTolerance:1)
grayscale()
}
}
}
元画像(sf.jpg)
出力画像(sample952a.png)
動作環境
Groovy1.6.0, JDK1.6 Update12
関連項目
groovyでクロマキー処理をする
No comments:
Post a Comment