4

I was wondering if it would be possible to recognize that a BufferedImage in java is a blank (invisible for a user in a browser) image.

  • 3
    Define "blank" does it have an alpha channel? Do you want a measure of homogeneity? Is "mostly white", "mostly blank" or "mostly transparent" invisible? On a white background, a uniform 5% grey (#F2F2F2) is quite visible but "boring". – msw Jul 11 '10 at 15:18
  • i mean total transparent – edwin eversdijk Jul 11 '10 at 16:56
  • http://stackoverflow.com/questions/2612152/drawrect-not-being-called-in-my-subclass-of-uiimageview check that may be its help you. – Shekhar Mar 15 '13 at 06:04

1 Answers1

1

You mean entirely transparent?

You could use the BufferedImage.getAlphaRaster() and traverse the pixels to check that they are all completely transparent.

aioobe
  • 413,195
  • 112
  • 811
  • 826
  • ok, i am trying the traversing... but what does it mean if an image has no alpharaster? getAlphaRaster() for some images it returns null? – edwin eversdijk Jul 11 '10 at 17:01
  • 1
    @edwin - then the image has no alpha channel and therefore cannot be transparent – a_m0d Jul 13 '10 at 06:33