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);