@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 = ImageIO.read(new File("sf2.jpg")) def img2 = new BufferedImage( img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB ) def pf = new PlasmaFilter() // 乱れを設定する(0-10) pf.setTurbulence(1.1f) // seed設定 pf.setSeed((int)(Math.random()*1000)) img2 = pf.filter(img2, null) def grf = new GrayscaleFilter() img2 = grf.filter(img2, null) def cf = new CompositeFilter( MiscComposite.getInstance(MiscComposite.BLEND, 0.5f)) img = cf.filter(img2, img) ImageIO.write(img, "png", new File("plasmacomposite.png"))元画像 出力画像
動作環境
groovy 1.8.6, JDK7 update4
No comments:
Post a Comment