private byte[] convertBitmapToBytes(final Bitmap bitmap){
  int size=bitmap.getRowBytes() * bitmap.getHeight();
  ByteArrayOutputStream out=new ByteArrayOutputStream(size);
  try {
    if (bitmap.compress(Bitmap.CompressFormat.PNG,0,out)) {
      return out.toByteArray();
    }
    if (sLogger.isActivated()) {
      sLogger.debug("Unable to convert bitmap, compression failed");
    }
    return null;
  }
  finally {
    CloseableUtils.tryToClose(out);
  }
}

private byte [ ] convertBitmapToBytes ( final Bitmap bitmap ) { int size = bitmap . getRowBytes ( ) * bitmap . getHeight ( ) ; ByteArrayOutputStream out = new ByteArrayOutputStream ( size ) ; try { if ( bitmap . compress ( Bitmap . CompressFormat . PNG , 0 , out ) ) { return out . toByteArray ( ) ; } if ( sLogger . isActivated ( ) ) { sLogger . debug ( "Unable to convert bitmap, compression failed" ) ; } return null ; } finally { CloseableUtils . tryToClose ( out ) ; } }
converts the specified bitmap to a byte array .
