0

Hi How can we identify Blank Image(White Image),

BufferReaderImage im = ImageIO.read("samplePath");

the image iam passing is empty with some height and width, i want to identify it

enter image description here

sasi
  • 4,192
  • 4
  • 28
  • 47

1 Answers1

0

This link should help you get started:

Get RGB values of a BufferedImage

In particular, this is the relevant part:

BufferedImage image = ImageIO.read(
     new URL("http://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png"));

int w = image.getWidth();
int h = image.getHeight();

int[] dataBuffInt = image.getRGB(0, 0, w, h, null, 0, w); 

Color c = new Color(dataBuffInt[100]);

System.out.println(c.getRed());   // = (dataBuffInt[100] >> 16) & 0xFF
System.out.println(c.getGreen()); // = (dataBuffInt[100] >> 8)  & 0xFF
System.out.println(c.getBlue());  // = (dataBuffInt[100] >> 0)  & 0xFF
System.out.println(c.getAlpha()); // = (dataBuffInt[100] >> 24) & 0xFF

Then go through all the entries and make sure there are some different values.

jarodeells
  • 356
  • 1
  • 5
  • 14
  • It didnt worked... jarodeells, Its giving same value for blank image and black& white images like 255,255,255,255 – sasi Jun 27 '15 at 09:09