From 710777a10a23c3dee659ba4a68386fb163cdc4dd Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Sun, 1 Sep 2024 22:49:34 +0800 Subject: [PATCH] refactor: change scalingMethod parameter to automatic for thumbnail generation (#6563) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /area core /kind improvement /milestone 2.19.0 #### What this PR does / why we need it: 将缩略图生成的模式改为自动,速度优先会导致图片失真率较高,部分图片在 w1600 的尺寸下看起来会比较模糊。 #### Does this PR introduce a user-facing change? ```release-note None ``` --- .../java/run/halo/app/core/attachment/ThumbnailGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/run/halo/app/core/attachment/ThumbnailGenerator.java b/application/src/main/java/run/halo/app/core/attachment/ThumbnailGenerator.java index 1152b9ba8..0a6af446f 100644 --- a/application/src/main/java/run/halo/app/core/attachment/ThumbnailGenerator.java +++ b/application/src/main/java/run/halo/app/core/attachment/ThumbnailGenerator.java @@ -74,7 +74,7 @@ public class ThumbnailGenerator { throw new UnsupportedOperationException( "Unsupported image format for: " + formatNameOpt.orElse("unknown")); } - var thumbnail = Scalr.resize(img, Scalr.Method.SPEED, Scalr.Mode.FIT_TO_WIDTH, + var thumbnail = Scalr.resize(img, Scalr.Method.AUTOMATIC, Scalr.Mode.FIT_TO_WIDTH, size.getWidth()); var formatName = formatNameOpt.orElse("jpg"); var thumbnailFile = getThumbnailFile(formatName);