ImageCompressUtil.java 文件源码

java
阅读 38 收藏 0 点赞 0 评论 0

项目:pc-android-controller-android 作者:
private static int calculateInSampleSize(BitmapFactory.Options options,
                                  int reqWidth, int reqHeight) {
    // Raw height and width of image
    final int height = options.outHeight;
    final int width = options.outWidth;
    int inSampleSize = 1;

    if (height > reqHeight || width > reqWidth) {
        if (width > height) {
            inSampleSize = Math.round((float) height / (float) reqHeight);
        } else {
            inSampleSize = Math.round((float) width / (float) reqWidth);
        }
    }
    return inSampleSize;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号