Java BufferedImage Filter applyFilter(BufferedImage img, ImageFilter filter)

Here you can find the source of applyFilter(BufferedImage img, ImageFilter filter)

Description

apply Filter

License

Open Source License

Declaration

public static void applyFilter(BufferedImage img, ImageFilter filter) 

Method Source Code


//package com.java2s;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.awt.image.FilteredImageSource;
import java.awt.image.ImageFilter;

public class Main {
    public static void applyFilter(BufferedImage img, ImageFilter filter) {
        FilteredImageSource src = new FilteredImageSource(img.getSource(), filter);
        Image fImg = Toolkit.getDefaultToolkit().createImage(src);
        Graphics2D g = img.createGraphics();
        g.drawImage(fImg, 0, 0, null, null);
        g.dispose();/*from w w  w . j  a  v  a2 s . c  o  m*/
    }
}

Related

  1. applyFilter(BufferedImage img, BufferedImageOp filter)
  2. applyFilter(LookupTable lookupTable, BufferedImage srcImg)
  3. filter(BufferedImage image, BufferedImageOp op)
  4. filterContrast(BufferedImage img)
  5. filterDetectLines(BufferedImage img)