提交 8d484466 编写于 作者: B Blankj

see 12/17 log

上级 e448f922
......@@ -349,6 +349,7 @@ getImageType : 获取图片类型
compressByScale : 按缩放压缩
compressByQuality : 按质量压缩
compressBySampleSize : 按采样大小压缩
getSize : 获取图片尺寸
```
* ### 意图相关 -> [IntentUtils.java][intent.java]
......
......@@ -349,6 +349,7 @@ getImageType
compressByScale
compressByQuality
compressBySampleSize
getSize
```
* ### About Intent -> [IntentUtils.java][intent.java]
......
......@@ -1872,6 +1872,30 @@ public final class ImageUtils {
return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options);
}
/**
* Return the size of bitmap.
*
* @param filePath The path of file.
* @return the size of bitmap
*/
public static int[] getSize(String filePath) {
return getSize(getFileByPath(filePath));
}
/**
* Return the size of bitmap.
*
* @param file The file.
* @return the size of bitmap
*/
public static int[] getSize(File file) {
if (file == null) return new int[]{0, 0};
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inJustDecodeBounds = true;
BitmapFactory.decodeFile(file.getAbsolutePath(), opts);
return new int[]{opts.outWidth, opts.outHeight};
}
/**
* Return the sample size.
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册