@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 imga = new BufferedImage( img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB ) def cf = new ChromeFilter() cf.setAmount(0.5f) cf.setExposure(1f) img = cf.filter(img, null) def lc = new LinearColormap((int)0xFFFFFFFF, (int)0xFF7799DD) LookupFilter lf = new LookupFilter(lc) lf.filter(img, imga) def ctf = new ContrastFilter() ctf.setContrast(1.1f) imga = ctf.filter(imga, null) ImageIO.write(imga, "png", new File("ice.png"))元画像 出力画像
動作環境
groovy 1.8.6, JDK7 update4
No comments:
Post a Comment