Example usage for java.awt.image BufferedImage BufferedImage

List of usage examples for java.awt.image BufferedImage BufferedImage

Introduction

In this page you can find the example usage for java.awt.image BufferedImage BufferedImage.

Prototype

public BufferedImage(int width, int height, int imageType) 

Source Link

Document

Constructs a BufferedImage of one of the predefined image types.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {

    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);

    int rgb = bufferedImage.getRGB(1, 1);

    int w = bufferedImage.getWidth(null);
    int h = bufferedImage.getHeight(null);
    int[] rgbs = new int[w * h];
    bufferedImage.getRGB(0, 0, w, h, rgbs, 0, w);

    rgb = 0xFF00FF00; // green
    bufferedImage.setRGB(1, 1, rgb);//w w w  .  jav  a2  s. c  o m
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
    ImageIO.write(bi, "png", new File("test.png"));
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_BYTE_INDEXED);

    float scaleFactor = 1.3f;
    RescaleOp op = new RescaleOp(scaleFactor, 0, null);
    bufferedImage = op.filter(bufferedImage, null);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int width = 100;
    int height = 100;
    BufferedImage bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_3BYTE_BGR);
    Image img = Toolkit.getDefaultToolkit().createImage(bufferedImage.getSource());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    int width = 100;
    int height = 100;

    BufferedImage bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    int width = 100;
    int height = 100;

    BufferedImage bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

    bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    int width = 100;
    int height = 100;

    BufferedImage bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

    bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

}

From source file:Main.java

public static void main(String[] args) throws Exception {
    BufferedImage original = new BufferedImage(100, 100, BufferedImage.TYPE_3BYTE_BGR);

    BufferedImage copy = original.getSubimage(10, 10, 50, 50);

    ImageIO.write(copy, "png", new File("Test.png"));
}

From source file:Main.java

public static void main(String[] args) {
    Image image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB);

    JFrame f = new JFrame();
    f.setIconImage(image);//from   w  w  w  . j  av a  2 s.c  om
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.pack();
    f.setSize(600, 400);
    f.setVisible(true);

    JFileChooser chooser = new JFileChooser();
    chooser.showOpenDialog(f);
}