From 961984df2498e9f589e5ac1ce0dc923a1fb90819 Mon Sep 17 00:00:00 2001 From: beyondkmp Date: Tue, 26 Aug 2025 14:34:16 +0800 Subject: [PATCH] fix: add sharp dependency for image processing and improve ocr (#9554) build: add sharp dependency for image processing * Added sharp as a dependency in package.json to enhance image processing capabilities. * Removed sharp from the devDependencies section. * Refactored OCR image preprocessing by integrating grayscale and normalization directly into the process, improving overall efficiency. --- src/main/utils/ocr.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/utils/ocr.ts b/src/main/utils/ocr.ts index b0079f2a50..ca63e82f07 100644 --- a/src/main/utils/ocr.ts +++ b/src/main/utils/ocr.ts @@ -7,8 +7,6 @@ const preprocessImage = async (buffer: Buffer) => { .grayscale() // 转为灰度 .normalize() .sharpen() - .threshold(100) // 可能需要根据具体图片调整 - .png({ quality: 100 }) .toBuffer() }