private Bitmap createPhotoThumbnail(InputStream imageStream,int rotationAngle){
  Bitmap bitmapRetValue=null;
  final int MAX_SIZE=1024, SAMPLE_SIZE=0, QUALITY=100;
  BitmapFactory.Options options=new BitmapFactory.Options();
  options.inPreferredConfig=Bitmap.Config.ARGB_8888;
  options.outWidth=-1;
  options.outHeight=-1;
  try {
    InputStream stream=ImageUtils.resizeImage(imageStream,MAX_SIZE,SAMPLE_SIZE,QUALITY);
    imageStream.close();
    bitmapRetValue=BitmapFactory.decodeStream(stream,null,options);
    if (0 != rotationAngle) {
      android.graphics.Matrix bitmapMatrix=new android.graphics.Matrix();
      bitmapMatrix.postRotate(rotationAngle);
      bitmapRetValue=Bitmap.createBitmap(bitmapRetValue,0,0,bitmapRetValue.getWidth(),bitmapRetValue.getHeight(),bitmapMatrix,false);
    }
    System.gc();
  }
 catch (  OutOfMemoryError e) {
    Log.e(LOG_TAG,"## createPhotoThumbnail : out of memory");
  }
catch (  Exception e) {
    Log.e(LOG_TAG,"## createPhotoThumbnail() Exception Msg=" + e.getMessage());
  }
  return bitmapRetValue;
}

private Bitmap createPhotoThumbnail ( InputStream imageStream , int rotationAngle ) { Bitmap bitmapRetValue = null ; final int MAX_SIZE = 1024 , SAMPLE_SIZE = 0 , QUALITY = 100 ; BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inPreferredConfig = Bitmap . Config . ARGB_8888 ; options . outWidth = - 1 ; options . outHeight = - 1 ; try { InputStream stream = ImageUtils . resizeImage ( imageStream , MAX_SIZE , SAMPLE_SIZE , QUALITY ) ; imageStream . close ( ) ; bitmapRetValue = BitmapFactory . decodeStream ( stream , null , options ) ; if ( 0 != rotationAngle ) { android . graphics . Matrix bitmapMatrix = new android . graphics . Matrix ( ) ; bitmapMatrix . postRotate ( rotationAngle ) ; bitmapRetValue = Bitmap . createBitmap ( bitmapRetValue , 0 , 0 , bitmapRetValue . getWidth ( ) , bitmapRetValue . getHeight ( ) , bitmapMatrix , false ) ; } System . gc ( ) ; } catch ( OutOfMemoryError e ) { Log . e ( LOG_TAG , "## createPhotoThumbnail : out of memory" ) ; } catch ( Exception e ) { Log . e ( LOG_TAG , "## createPhotoThumbnail() Exception Msg=" + e . getMessage ( ) ) ; } return bitmapRetValue ; }
create a thumbnail from an image stream with a rotation angle .
