From de2a83c0a0770e6c96a602673ec54ce46edea6a8 Mon Sep 17 00:00:00 2001 From: Izai Alejandro Zalles Merino Date: Mon, 13 Oct 2025 09:47:44 -0400 Subject: [PATCH] feat(magic): suggest OCR on image inputs (Magic) - Add Magic checks to Optical Character Recognition to detect common image formats via magic bytes - Provide default args (show confidence, LSTM engine) when auto-suggested Authored-by: Izai Alejandro Zalles Merino --- src/core/operations/OpticalCharacterRecognition.mjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/operations/OpticalCharacterRecognition.mjs b/src/core/operations/OpticalCharacterRecognition.mjs index dfcff965..fd028e4b 100644 --- a/src/core/operations/OpticalCharacterRecognition.mjs +++ b/src/core/operations/OpticalCharacterRecognition.mjs @@ -46,6 +46,13 @@ class OpticalCharacterRecognition extends Operation { defaultIndex: 1 } ]; + this.checks = [ + { + pattern: "^(?:\xff\xd8\xff|\x89\x50\x4e\x47|\x47\x49\x46|.{8}\x57\x45\x42\x50|\x42\x4d)", + args: [true, "LSTM only"], + useful: true + } + ]; } /**