public class ImageUtils {
public static boolean isImage(File imageFile) {
if (!imageFile.exists()) {
return false;
}
try {
Image img = ImageIO.read(imageFile);
return img != null && img.getWidth(null) > 0 && img.getHeight(null) > 0;
} catch (Exception e) {
return false;
}
}
}
Java判断图片格式
最新推荐文章于 2023-07-20 09:55:15 发布