Save fullscreen screenshot alongside cropped tooltip in diff-ocr
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
674a25ac6a
commit
f9b8ef9158
1 changed files with 12 additions and 5 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue