List of utility methods to do Image to BufferedImage
BufferedImage | ImageToBufferedImage(Image image, int width, int height) Image To Buffered Image BufferedImage dest = new BufferedImage(width, height, 2); Graphics2D g2 = dest.createGraphics(); g2.drawImage(image, 0, 0, null); g2.dispose(); return dest; |
BufferedImage | imageToBufferedImage(Image img) image To Buffered Image try { MediaTracker tracker = new MediaTracker(new Component() { private static final long serialVersionUID = 1L; }); tracker.addImage(img, 0); tracker.waitForAll(); } catch (InterruptedException ie) { ie.printStackTrace(); ... |
BufferedImage | imageToBufferedImage(Image img) Converts a given Image into a BufferedImage if (img instanceof BufferedImage) { return (BufferedImage) img; BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics2D bGr = bimage.createGraphics(); bGr.drawImage(img, 0, 0, null); bGr.dispose(); ... |
BufferedImage | imageToBufferedImage(Image pImage) image To Buffered Image int w = pImage.getWidth(null); int h = pImage.getHeight(null); int type = BufferedImage.TYPE_INT_ARGB; BufferedImage lBufferedImage = new BufferedImage(w, h, type); Graphics2D g2 = lBufferedImage.createGraphics(); g2.drawImage(pImage, 0, 0, null); g2.dispose(); return lBufferedImage; ... |
BufferedImage | imageToBufferedImage(Image src) image To Buffered Image int width = 0; int height = 0; if (src != null) { width = src.getWidth(null); height = src.getHeight(null); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR); Graphics2D g = image.createGraphics(); ... |
BufferedImage | makeBufferedImage(final Image image) make Buffered Image BufferedImage bImg = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bImg.createGraphics(); g2.drawImage(image, null, null); g2.dispose(); return bImg; |
BufferedImage | makeBufferedImage(Image image) make Buffered Image return makeBufferedImage(image, BufferedImage.TYPE_INT_RGB);
|
BufferedImage | makeBufferedImage(Image image) Creates a buffered image from the supplied image. if (image == null) System.out.println("ImageUtilities l.67 Image null"); return makeBufferedImage(image, BufferedImage.TYPE_INT_RGB); |
BufferedImage | makeRGBABufferedImageFromImage(Image image) make RGBA Buffered Image From Image if (image instanceof BufferedImage) { return (BufferedImage) image; image = new ImageIcon(image).getImage(); boolean hasAlpha = hasAlpha(image); BufferedImage bImage = null; try { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ... |
BufferedImage | toBufferedImage(Image i) to Buffered Image BufferedImage result = new BufferedImage(i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics2D g = result.createGraphics(); g.drawImage(i, 0, 0, null); g.dispose(); return result; |