Java examples for 2D Graphics:BufferedImage Color
Image has Alpha Component
//package com.java2s; import java.awt.Image; import java.awt.image.PixelGrabber; public class Main { private static final boolean hasAlphaComponent(Image img) { // Use a pixel grabber to retrieve the image's color model; // grabbing a single pixel PixelGrabber pg = new PixelGrabber(img, 0, 0, 1, 1, false); try {// w ww. j ava2 s. c o m //grabbed the pixel pg.grabPixels(); //checking if has ALPHA component if (pg.getColorModel().hasAlpha()) return true; else return false; } catch (InterruptedException e) { System.out .println("Unable to retrieve APLHA information for Image "); return false; } } }