import javax.imageio.*;
import groovy.swing.j2d.*
import com.jhlabs.image.*;
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 {
    lc = new LinearColormap((int)0xFFFFFF10, (int)0xFF3070A0)
    lookup(colormap:lc)
  }
}
}
元画像(sf.jpg)
出力画像(sample952a.png)

動作環境
Groovy1.6.0, JDK1.6 Update12
関連項目
groovyで炎のような画像を生成する (ArrayColormapの使用例)
 
No comments:
Post a Comment