Android How to - Get Bitmap size








Question

We would like to know how to get Bitmap size.

Answer


import android.graphics.Bitmap;

public class Main {
  public static int getBitmapSize(Bitmap bitmap) {
    return bitmap.getRowBytes() * bitmap.getHeight();
  }

}