/**
* 检查图片是否损坏
* @param filePath 图片路径
* @return true 图片破损
*/
public static boolean checkImgDamage(String filePath) {
BitmapFactory.Options options = null;
if (options == null) {
options = new BitmapFactory.Options();
}
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(filePath, options);
if (options.mCancel || options.outWidth == -1
|| options.outHeight == -1) {
return true;
}
return false;
}
网友评论