public class ImageUtil extends Object
| 构造器和说明 |
|---|
ImageUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Rectangle |
calcRotatedSize(Rectangle src,
int angel)
计算旋转后的图片
|
static boolean |
checkIfIsImage(File file)
判断文件是否为图片
在上传图片文件的时候除了需要限制文件的大小,通常还需要对文件类型进行判断。
|
static void |
compressPic(String srcFilePath,
String descFilePath,
Float quality)
压缩图片
|
static BufferedImage |
decodeJPEG(byte[] b)
解析
|
static byte[] |
encodeJPEG(BufferedImage img)
编码 JPG。
|
static BufferedImage |
Rotate(Image src,
int angel)
对图片进行旋转(无损)
|
public static boolean checkIfIsImage(File file)
file - public static BufferedImage Rotate(Image src, int angel)
src - 被旋转图片angel - 旋转角度public static Rectangle calcRotatedSize(Rectangle src, int angel)
src - 被旋转的图片angel - 旋转角度public static void compressPic(String srcFilePath, String descFilePath, Float quality) throws IOException
srcFilePath - descFilePath - quality - IOExceptionpublic static byte[] encodeJPEG(BufferedImage img)
img - public static BufferedImage decodeJPEG(byte[] b)
b - Copyright © 2013–2021 AJAXJS. All rights reserved.