From f9b8ef915806ae77cab466530dd93f6de81635f0 Mon Sep 17 00:00:00 2001 From: Boki Date: Wed, 11 Feb 2026 14:09:42 -0500 Subject: [PATCH] Save fullscreen screenshot alongside cropped tooltip in diff-ocr Co-Authored-By: Claude Opus 4.6 --- tools/OcrDaemon/OcrHandler.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/OcrDaemon/OcrHandler.cs b/tools/OcrDaemon/OcrHandler.cs index 4a695f0..1456a3d 100644 --- a/tools/OcrDaemon/OcrHandler.cs +++ b/tools/OcrDaemon/OcrHandler.cs @@ -182,13 +182,20 @@ class OcrHandler(TesseractEngine engine) // Pre-process for OCR: boost contrast, invert colors using var processed = ImagePreprocessor.PreprocessForOcr(cropped, options); - // Save preprocessed version alongside raw - if (!string.IsNullOrEmpty(req.Path) && options.Preprocess) + // Save fullscreen and preprocessed versions alongside raw + if (!string.IsNullOrEmpty(req.Path)) { var ext = Path.GetExtension(req.Path); - var prePath = Path.ChangeExtension(req.Path, ".pre" + ext); - processed.Save(prePath, ImageUtils.GetImageFormat(prePath)); - if (debug) Console.Error.WriteLine($" diff-ocr: saved preprocessed to {prePath}"); + var fullPath = Path.ChangeExtension(req.Path, ".full" + ext); + current.Save(fullPath, ImageUtils.GetImageFormat(fullPath)); + if (debug) Console.Error.WriteLine($" diff-ocr: saved fullscreen to {fullPath}"); + + if (options.Preprocess) + { + var prePath = Path.ChangeExtension(req.Path, ".pre" + ext); + processed.Save(prePath, ImageUtils.GetImageFormat(prePath)); + if (debug) Console.Error.WriteLine($" diff-ocr: saved preprocessed to {prePath}"); + } } using var pix = ImageUtils.BitmapToPix(processed); using var page = engine.Process(pix);