From 9831bce68320a60613c8386a80ec1bf25ff3696c Mon Sep 17 00:00:00 2001 From: hbl917070 Date: Tue, 14 May 2024 01:26:08 +0800 Subject: [PATCH] Attempt to fix the issue of unable to open images --- Tiefsee/Lib/ImgLib.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Tiefsee/Lib/ImgLib.cs b/Tiefsee/Lib/ImgLib.cs index 99f3820..fa4f97d 100644 --- a/Tiefsee/Lib/ImgLib.cs +++ b/Tiefsee/Lib/ImgLib.cs @@ -808,8 +808,16 @@ public static string VipsResize(string path, double scale, string fileType, stri kernel = Enums.Kernel.Nearest; gap = null; } - using NetVips.Image imR = im.Resize(scale: scale, kernel: kernel, gap: gap); - VipsSave(imR, filePath, "auto"); + try { + using NetVips.Image imR = im.Resize(scale: scale, kernel: kernel, gap: gap); + VipsSave(imR, filePath, "auto"); + } + catch { + kernel = Enums.Kernel.Nearest; + gap = null; + using NetVips.Image imR = im.Resize(scale: scale, kernel: kernel, gap: gap); + VipsSave(imR, filePath, "auto"); + } StartWindow.isRunGC = true; // 定時執行GC