@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 ff = new FillFilter((int)0xff33ffbb) img2 = ff.filter(img2, null) def cf = new CompositeFilter( MiscComposite.getInstance(MiscComposite.BLEND, 0.2f)) img = cf.filter(img2, img) ImageIO.write(img, "png", new File("tint.png"))元画像 出力画像
動作環境
groovy 1.8.6, JDK7 update4
No comments:
Post a Comment