From 699e14acac49905229a8c99363e4220e8f78d7b4 Mon Sep 17 00:00:00 2001 From: neko <52202080+akiyamaneko@users.noreply.github.com> Date: Tue, 29 Sep 2020 11:07:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E9=A2=9C=E8=89=B2=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E4=BC=9A=E5=AF=BC=E8=87=B4255=E5=8F=96=E4=B8=8D?= =?UTF-8?q?=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java b/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java index fe107ad31..614814a2b 100644 --- a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java @@ -61,6 +61,12 @@ public class ImgUtil { public static final String IMAGE_TYPE_BMP = "bmp";// 英文Bitmap(位图)的简写,它是Windows操作系统中的标准图像文件格式 public static final String IMAGE_TYPE_PNG = "png";// 可移植网络图形 public static final String IMAGE_TYPE_PSD = "psd";// Photoshop的专用格式Photoshop + + /** + * RGB颜色范围上限 + */ + private static final int RGB_COLOR_BOUND = 256; + // ---------------------------------------------------------------------------------------------------------------------- scale @@ -1952,7 +1958,7 @@ public class ImgUtil { if (null == random) { random = RandomUtil.getRandom(); } - return new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255)); + return new Color(random.nextInt(RGB_COLOR_BOUND), random.nextInt(RGB_COLOR_BOUND), random.nextInt(RGB_COLOR_BOUND)); } /**