public class ImageUtils extends Object
| Constructor and Description |
|---|
ImageUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
dHash(BufferedImage srcImage) |
static long |
hammingDistance(String dHash1,
String dHash2)
计算海明距离(即相似度差异值,一般值小于5为同一张图片)
|
static BufferedImage |
replaceQrCode(BufferedImage originImage,
BufferedImage qrImage) |
static BufferedImage |
replaceQrCode(BufferedImage originImage,
BufferedImage qrImage,
int deviate)
替换原图片里面的二维码
|
static boolean |
resize(BufferedImage source,
File dist,
float scale,
float quality) |
static boolean |
resize(BufferedImage source,
File dist,
int width,
int height,
float quality)
重置图片大小并将重置后的文件写入目标文件
|
static net.coobird.thumbnailator.Thumbnails.Builder<BufferedImage> |
resize(BufferedImage source,
float scale,
float quality) |
static net.coobird.thumbnailator.Thumbnails.Builder<BufferedImage> |
resize(BufferedImage source,
float scale,
float quality,
String format) |
static net.coobird.thumbnailator.Thumbnails.Builder<BufferedImage> |
resize(BufferedImage source,
int width,
int height,
float quality) |
static net.coobird.thumbnailator.Thumbnails.Builder<BufferedImage> |
resize(BufferedImage source,
int width,
int height,
float quality,
String format)
重置图片大小
|
public static BufferedImage replaceQrCode(BufferedImage originImage, BufferedImage qrImage, int deviate) throws com.google.zxing.NotFoundException
originImage - 原图qrImage - 要替换的二维码deviate - 定位点与起始点的差值com.google.zxing.NotFoundException - 识别二维码失败public static BufferedImage replaceQrCode(BufferedImage originImage, BufferedImage qrImage) throws com.google.zxing.NotFoundException
com.google.zxing.NotFoundExceptionpublic static long hammingDistance(String dHash1, String dHash2)
dHash1 - dHash值1dHash2 - dHash值2public static String dHash(BufferedImage srcImage)
srcImage - 源图片public static net.coobird.thumbnailator.Thumbnails.Builder<BufferedImage> resize(BufferedImage source, int width, int height, float quality, String format)
source - 源图片width - 宽度height - 高度quality - 质量format - 输出文件格式public static net.coobird.thumbnailator.Thumbnails.Builder<BufferedImage> resize(BufferedImage source, int width, int height, float quality)
public static boolean resize(BufferedImage source, File dist, int width, int height, float quality)
source - 源图片dist - 目标文件width - 宽度height - 高度quality - 质量public static net.coobird.thumbnailator.Thumbnails.Builder<BufferedImage> resize(BufferedImage source, float scale, float quality, String format)
public static net.coobird.thumbnailator.Thumbnails.Builder<BufferedImage> resize(BufferedImage source, float scale, float quality)
public static boolean resize(BufferedImage source, File dist, float scale, float quality)
Copyright © 2022. All rights reserved.