List of utility methods to do BufferedImage Color
Color | getUniqueColor(BufferedImage origImg, boolean findLightColor) get Unique Color BufferedImage img = createImageCopy(origImg); Color pixelColor = Color.WHITE; Color uniqueColor = Color.WHITE; int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData(); Arrays.sort(pixels); int iter = 0; for (int i = 0; i < pixels.length; i++) { iter++; ... |
BufferedImage | makeColorTransparent(BufferedImage image, Color color) Hace que el color seleccionado sea transparente en un BufferedImage BufferedImage bi = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g = bi.createGraphics(); g.setComposite(AlphaComposite.Src); g.drawImage(image, null, 0, 0); g.dispose(); for (int i = 0; i < bi.getHeight(); i++) { for (int j = 0; j < bi.getWidth(); j++) { if (bi.getRGB(j, i) == color.getRGB()) { ... |