List of usage examples for java.awt.image BufferedImage TYPE_INT_ARGB
int TYPE_INT_ARGB
To view the source code for java.awt.image BufferedImage TYPE_INT_ARGB.
Click Source Link
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 { 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 { 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) { Image image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); JPanel gui = new JPanel(new BorderLayout()); JLabel clouds = new JLabel(new ImageIcon(new BufferedImage(250, 100, BufferedImage.TYPE_INT_RGB))); gui.add(clouds);// ww w .j a va2s. c o m JOptionPane.showConfirmDialog(null, gui, "Title", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, new ImageIcon(image)); }
From source file:Main.java
public static void main(String[] args) throws IOException { BufferedImage img = new BufferedImage(20, 20, BufferedImage.TYPE_INT_ARGB); Graphics2D g = img.createGraphics(); g.setColor(Color.white);//from w w w .j a va 2 s . c o m g.fillRect(0, 0, 20, 20); g.setColor(Color.black); g.fillRect(5, 5, 10, 10); Color[] mapping = new Color[] { Color.black, Color.white, // replace black with white Color.white, Color.green // and white with green }; ImageIO.write(img, "png", new File("original.png")); swapColors(img, mapping); ImageIO.write(img, "png", new File("swapped.png")); }
From source file:Main.java
static public void main(String args[]) throws Exception { int width = 200, height = 200; BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D ig2 = bi.createGraphics(); ig2.fillRect(0, 0, width - 1, height - 1); BasicStroke stroke = new BasicStroke(10, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); ig2.setPaint(Color.lightGray); ig2.setStroke(stroke);/*from ww w.j av a2s. co m*/ ig2.draw(new Ellipse2D.Double(0, 0, 100, 100)); ImageIO.write(bi, "GIF", new File("a.gif")); }
From source file:Main.java
static public void main(String args[]) throws Exception { int width = 200, height = 200; BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D ig2 = bi.createGraphics(); ig2.fillRect(0, 0, width - 1, height - 1); Iterator imageWriters = ImageIO.getImageWritersByFormatName("GIF"); ImageWriter imageWriter = (ImageWriter) imageWriters.next(); File file = new File("filename.gif"); ImageOutputStream ios = ImageIO.createImageOutputStream(file); imageWriter.setOutput(ios);/*from w w w. ja v a 2 s. c om*/ imageWriter.write(bi); }
From source file:Main.java
public static void main(String[] args) throws Exception { BufferedImage originalImage = ImageIO.read(new File("test.png")); int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType(); BufferedImage resizeImageBmp = resizeImage(originalImage, type); ImageIO.write(resizeImageBmp, "png", new File("a.png")); resizeImageBmp = resizeImageWithHint(originalImage, type); ImageIO.write(resizeImageBmp, "png", new File("b.png")); }
From source file:Main.java
public static void main(String[] args) throws Exception { int size = 200; BufferedImage image = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); Graphics2D g = image.createGraphics(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(Color.BLUE);/*w w w . ja va 2 s . c o m*/ for (int i = 0; i < size; i += 5) { g.drawOval(i, i, size - i, size - i); } g.dispose(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(image, "png", baos); String data = DatatypeConverter.printBase64Binary(baos.toByteArray()); String imageString = "data:image/png;base64," + data; String html = "<html><body><img src='" + imageString + "'></body></html>"; System.out.println(html); }