Android Bitmap Compress compressToBytes(Bitmap bitmap, int quality)

Here you can find the source of compressToBytes(Bitmap bitmap, int quality)

Description

compress To Bytes

Declaration

public static byte[] compressToBytes(Bitmap bitmap, int quality) 

Method Source Code

//package com.java2s;

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

import java.io.ByteArrayOutputStream;

public class Main {
    public static byte[] compressToBytes(Bitmap bitmap, int quality) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream(65536);
        bitmap.compress(CompressFormat.JPEG, quality, baos);
        return baos.toByteArray();
    }/*w w w .ja v a 2s . c o m*/
}

Related

  1. flattenBitmap(Bitmap bitmap)
  2. smallPic(String oldPath, String newPath, int size)
  3. compressWithWidth(Bitmap bitmap, int width)
  4. compressWithWidth(String filePath, int width)
  5. compressBitmap(Bitmap bitmap)
  6. compress(String srcPath, String dstPath, int maxWidth, int maxHeight, long maxSize, CompressFormat format)
  7. compress(byte[] data, String dstPath, int maxWidth, int maxHeight, long maxSize, CompressFormat format)
  8. decodeToCompressedByteArray(String imageUri)
  9. downsampleBitmap(FileDescriptor fd, int maxArea)