@Grab(group='com.jhlabs', module='filters', version='2.0.235') import java.awt.* import java.awt.image.* import java.io.* import javax.imageio.* import com.jhlabs.composite.* import com.jhlabs.image.* // 濃淡のある画像を生成する def img = new BufferedImage( 200, 200, BufferedImage.TYPE_INT_RGB ) def pf = new PlasmaFilter() // 乱れを設定する(0-10) pf.setTurbulence(1.1f) // seed設定 pf.setSeed((int)(Math.random()*1000)) img = pf.filter(img, null) def lc = new LinearColormap((int)0xFF3070A0, (int)0xFFFFFFFF) LookupFilter lf = new LookupFilter(lc) img = lf.filter(img, null) ImageIO.write(img, "png", new File("plasmatwotone.png"))出力画像
動作環境
groovy 1.8.6, JDK7 update4
No comments:
Post a Comment