| Modifier and Type | Method and Description |
|---|---|
static void |
compress(String srcImg,
float scale,
float quality,
String destImg)
压缩图片
|
static void |
convert(String srcImg,
String destImg)
图片格式转换
|
static void |
crop(String srcImg,
int x,
int y,
int width,
int height,
String destImg)
裁剪
|
static String |
getRealType(String imgPath)
获取图片真实格式
|
static void |
watermark(String targetImg,
String watermarkImg,
net.coobird.thumbnailator.geometry.Positions positions,
int width,
int height,
float opacity,
String destImg)
添加水印图片
|
public static void compress(String srcImg, float scale, float quality, String destImg) throws IOException
srcImg - 原始图片scale - 尺寸quality - 压缩质量destImg - 压缩后的图片IOExceptionpublic static void crop(String srcImg, int x, int y, int width, int height, String destImg) throws IOException
srcImg - 原始图片x - y - width - height - destImg - 裁剪后的图片IOExceptionpublic static void convert(String srcImg, String destImg)
srcImg - 原图片destImg - 要转换的图片 (带格式)public static void watermark(String targetImg, String watermarkImg, net.coobird.thumbnailator.geometry.Positions positions, int width, int height, float opacity, String destImg) throws IOException
targetImg - 目标图片: 要添加水印的图片watermarkImg - 水印图片positions - 位置width - 宽度height - 高度opacity - 透明度destImg - 生成的图片IOExceptionCopyright © 2021. All rights reserved.