Android Bitmap Compress compressBitmap(Bitmap bitmap)

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

Description

compress Bitmap

Declaration

public static byte[] compressBitmap(Bitmap bitmap) 

Method Source Code

//package com.java2s;

import android.graphics.Bitmap;

import java.io.ByteArrayOutputStream;

public class Main {
    private static final int COMPRESS_JPEG_QUALITY = 90;

    public static byte[] compressBitmap(Bitmap bitmap) {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.JPEG, COMPRESS_JPEG_QUALITY,
                os);//from  ww  w. j  a v  a 2 s  .co  m
        return os.toByteArray();
    }
}

Related

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