Convert a non-RGB image to an RGB buffered image: : ImageIcon « 2D Graphics « Java Tutorial






import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;

public class Main {
  public static void main(String[] argv) throws Exception {
    Image image = new ImageIcon("image.gif").getImage();

    BufferedImage bimage = new BufferedImage(image.getWidth(null), image
        .getHeight(null), BufferedImage.TYPE_INT_RGB);

    Graphics2D g = bimage.createGraphics();
    g.drawImage(image, 0, 0, null);
    g.dispose();
  }
}








16.32.ImageIcon
16.32.1.Load image to ImageIcon and add it to Panel
16.32.2.Load an Icon from a jar
16.32.3.Convert a non-RGB image to an RGB buffered image:
16.32.4.Return a filled oval as an Icon
16.32.5.Change JFrame image icon
16.32.6.A button which paints on it one or more scaled arrows in one of the cardinal directions
16.32.7.RGB Gray Filter