import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import com.jhlabs.composite.*;
import com.jhlabs.image.*;
public class Java2DTest64
{
public static void main(String args[])
throws Exception
{
/* 画像を指定した色のモノトーンのイメージに変換する */
BufferedImage img = ImageIO.read(new File("sf2.jpg"));
BufferedImage imga = new BufferedImage(
img.getWidth(), img.getHeight(),
BufferedImage.TYPE_INT_ARGB
);
GrayscaleFilter gf = new GrayscaleFilter();
BufferedImage img2 = gf.filter(img, imga);
BufferedImage img3 = new BufferedImage(
img.getWidth(), img.getHeight(),
BufferedImage.TYPE_INT_ARGB
);
FillFilter ff = new FillFilter(0xff7799dd);
BufferedImage img4 = ff.filter(img3, null);
CompositeFilter cf = new CompositeFilter(
MiscComposite.getInstance(MiscComposite.BLEND, 0.5f));
BufferedImage img5 = cf.filter(img2, img4);
ImageIO.write(img5, "png", new File("sample1965a.png"));
}
}
元画像(sf2.jpg)
出力画像(sample1965a.png)
関連項目
Jerry Huxtableさんのホームページ
http://www.jhlabs.com/index.html
Java Image Filtersのページ
http://www.jhlabs.com/ip/filters/
java.net でのプロジェクトページ
https://pixels.dev.java.net/
No comments:
Post a Comment