Android Bitmap Load getBitmapFromFileInputStream(FileInputStream is)

Here you can find the source of getBitmapFromFileInputStream(FileInputStream is)

Description

get Bitmap From File Input Stream

License

Open Source License

Declaration

public static Bitmap getBitmapFromFileInputStream(FileInputStream is) 

Method Source Code

//License from project: Open Source License 

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import org.ixming.android.utils.FrameworkLog;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;

public class Main{
    static final String TAG = "sharebind_bitmaputil";
    public static Bitmap getBitmapFromFileInputStream(FileInputStream is) {
        if (is == null)
            return null;
        Bitmap bitmap = null;/*  w w w . j  ava  2s. c om*/
        try {
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inPreferredConfig = Config.RGB_565;
            options.inPurgeable = true;
            options.inInputShareable = true;
            bitmap = BitmapFactory.decodeFileDescriptor(is.getFD(), null,
                    options);
        } catch (Exception e) {
            bitmap = null;
            FrameworkLog.e(TAG, "getBitmapFromFileInputStream Exception: "
                    + e.getMessage());
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (Exception e) {
                }
            }
        }
        return bitmap;
    }
}

Related

  1. getBitmap(Resources resources, int resourceId)
  2. getBitmap(String url, Context context, String newPicName)
  3. getBitmapFromAsset(Context context, String strName)
  4. getBitmapFromFile(File file)
  5. getBitmapFromFile(String filePath)
  6. getBitmapFromRes(Context context, int resId)
  7. getFromUrl(String url)
  8. getImageFromUri(Context ctx, Uri uri, int reqWidth, int reqHeight)
  9. getNetBitmap(String strUrl, File file, Context context, File file2)