Android Bitmap Save bitmap2Stream(Bitmap bitmap)

Here you can find the source of bitmap2Stream(Bitmap bitmap)

Description

bitmap Stream

Declaration

public static final InputStream bitmap2Stream(Bitmap bitmap) 

Method Source Code

//package com.java2s;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

import java.io.InputStream;

import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;

public class Main {
    public static final InputStream bitmap2Stream(Bitmap bitmap) {
        return bitmap2Stream(bitmap, CompressFormat.JPEG, 100);
    }//w w  w.ja  v  a2  s .c  o m

    public static final InputStream bitmap2Stream(Bitmap bitmap,
            CompressFormat format, int quality) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bitmap.compress(format, quality, baos);
        InputStream stream = new ByteArrayInputStream(baos.toByteArray());
        return stream;
    }
}

Related

  1. addBitmapToMemoryCache(String key, Bitmap bitmap)
  2. base64Bitmap(Bitmap bitmap)
  3. bitmap2File(Bitmap bitmap, File file)
  4. getImagePath(Context context, Bitmap inImage)
  5. saveBitmap(Bitmap bitmap, File file)
  6. saveBitmap(String bitName, Bitmap bitmap)
  7. saveBitmap(final Bitmap bitmap, final String savePath)