public class ImageUtils extends Object
| 构造器和说明 |
|---|
ImageUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static BufferedImage |
clearWhiteBackground(BufferedImage in,
int gray)
清除图片背景
|
static BufferedImage |
createImage(int width,
int height,
boolean isTransparent)
创建图片
|
static int |
gray(int r,
int g,
int b)
计算灰度
|
static BufferedImage |
readJB2(InputStream in)
读取JB2格式图片
|
static BufferedImage |
renderMask(BufferedImage image,
BufferedImage mask)
蒙版抠图
根据mask中像素的颜色将原图中的像素抠掉
|
static byte[] |
toBytes(BufferedImage bufferedImage,
String type) |
public static byte[] toBytes(BufferedImage bufferedImage, String type) throws IOException
IOExceptionpublic static BufferedImage readJB2(InputStream in) throws IOException
in - 图片数据流IOException - 图片操作异常public static BufferedImage renderMask(BufferedImage image, BufferedImage mask)
根据mask中像素的颜色将原图中的像素抠掉
image - 原始图片mask - 蒙板图片public static int gray(int r,
int g,
int b)
r - 红色通道g - 绿色通道b - 蓝色通道public static BufferedImage createImage(int width, int height, boolean isTransparent)
width - 图形宽度height - 图像高度isTransparent - 是否透明public static BufferedImage clearWhiteBackground(BufferedImage in, int gray)
in - 输入图片gray - 灰度阈值(0-255),图像中大于该值的像素将会被删除。Copyright © 2022. All rights reserved.