public static Bitmap resize(File original, int width, int height, ResizeMode mode) {
    Bitmap sampledSrcBitmap = ImageDecoder.decodeFile(original, width, height);
    if (sampledSrcBitmap == null) {
      return null;
    }

    return resize(sampledSrcBitmap, width, height, mode);
  }
  public static Bitmap resize(
      Resources resources, int resId, int width, int height, ResizeMode mode) {
    Bitmap sampledSrcBitmap = ImageDecoder.decodeResource(resources, resId, width, height);
    if (sampledSrcBitmap == null) {
      return null;
    }

    return resize(sampledSrcBitmap, width, height, mode);
  }