public class ImageUtil extends Object
| 构造器和说明 |
|---|
ImageUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
converter(File imgFile,
String format,
File formatFile)
转换图片类型
|
static void |
reduceImageByRatio(String srcImagePath,
String toImagePath,
int widthRatio,
int heightRatio)
按倍率缩小图片
|
static void |
reduceImageByRatioPNG(String srcImagePath,
String toImagePath,
int widthRatio,
int heightRatio)
按倍率缩小图片png透明不变黑
|
static void |
reduceImageByTarget(String srcImagePath,
String toImagePath,
int widthTarget,
int heightTarget)
按尺寸缩小图片
|
static void |
reduceImageByTargetPNG(String srcImagePath,
String toImagePath,
int widthTarget,
int heightTarget)
按尺寸缩小图片
|
public static void reduceImageByRatio(String srcImagePath, String toImagePath, int widthRatio, int heightRatio) throws IOException
srcImagePath - 读取图片路径toImagePath - 写入图片路径widthRatio - 宽度缩小比例heightRatio - 高度缩小比例IOExceptionpublic static void reduceImageByRatioPNG(String srcImagePath, String toImagePath, int widthRatio, int heightRatio) throws IOException
srcImagePath - 读取图片路径toImagePath - 写入图片路径widthRatio - 宽度缩小比例heightRatio - 高度缩小比例IOExceptionpublic static void reduceImageByTarget(String srcImagePath, String toImagePath, int widthTarget, int heightTarget) throws IOException
srcImagePath - 读取图片路径toImagePath - 写入图片路径widthTarget - 缩小目标宽度heightTarget - 缩小目标高度IOExceptionpublic static void reduceImageByTargetPNG(String srcImagePath, String toImagePath, int widthTarget, int heightTarget) throws IOException
srcImagePath - 读取图片路径toImagePath - 写入图片路径widthTarget - 缩小目标宽度heightTarget - 缩小目标高度IOExceptionpublic static void converter(File imgFile, String format, File formatFile) throws IOException
imgFile - 原图片format - 图片格式formatFile - 新图片IOExceptionCopyright © 2023. All rights reserved.