Java Image Filter filter(ImageIcon image, RGBImageFilter filter)

Here you can find the source of filter(ImageIcon image, RGBImageFilter filter)

Description

Utility method that filters the image.

License

Open Source License

Parameter

Parameter Description
image the image to be filtered.
filter the filter to be used.

Return

the filtered image.

Declaration

public static ImageIcon filter(ImageIcon image, RGBImageFilter filter) 

Method Source Code

//package com.java2s;

import java.awt.Toolkit;

import java.awt.image.FilteredImageSource;
import java.awt.image.ImageProducer;
import java.awt.image.RGBImageFilter;

import javax.swing.ImageIcon;

public class Main {
    /**// ww  w.  ja  v a2 s. c  o  m
     * Utility method that filters the image.
     * 
     * @param image
     *            the image to be filtered.
     * @param filter
     *            the filter to be used.
     * 
     * @return the filtered image.
     */
    public static ImageIcon filter(ImageIcon image, RGBImageFilter filter) {
        ImageProducer prod = new FilteredImageSource(image.getImage().getSource(), filter);
        ImageIcon filteredImage = new ImageIcon(Toolkit.getDefaultToolkit().createImage(prod));

        return filteredImage;
    }
}

Related

  1. createIcon(ImageIcon icon, ImageFilter filter)
  2. createIcon(ImageIcon icon, ImageFilter filter)
  3. createKC854HiresImageFileFilter()
  4. createQualityResizedImage( Image orginalImage, int width, int height, boolean applySoftFilter, boolean keepRatio, Color bgColor, boolean fast)
  5. getImageIconFilter()