import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import com.jhlabs.composite.*;
import com.jhlabs.image.*;
public class Java2DTest75
{
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
);
// 拡散
DiffuseFilter gf = new DiffuseFilter();
gf.setScale(2);
img = gf.filter(img, imga);
// ガウシアンブラー
GaussianFilter gaf = new GaussianFilter(3f);
img = gaf.filter(img, null);
BufferedImage img2 = ImageIO.read(new File("sf2.jpg"));
ContrastFilter ctf = new ContrastFilter();
ctf.setBrightness(0.7f);
ctf.setContrast(0.7f);
img2 = ctf.filter(img2, imga);
CompositeFilter cf = new CompositeFilter(
MiscComposite.getInstance(MiscComposite.DODGE, 0.5f));
BufferedImage img3 = cf.filter(img2, img);
ImageIO.write(img3, "png", new File("sample1976a.png"));
}
}
元画像(sf2.jpg)
出力画像(sample1976a.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/