Skip to content

Commit de2a83c

Browse files
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 <zallesrene@gmail.com>
1 parent a4f4040 commit de2a83c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/core/operations/OpticalCharacterRecognition.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ class OpticalCharacterRecognition extends Operation {
4646
defaultIndex: 1
4747
}
4848
];
49+
this.checks = [
50+
{
51+
pattern: "^(?:\xff\xd8\xff|\x89\x50\x4e\x47|\x47\x49\x46|.{8}\x57\x45\x42\x50|\x42\x4d)",
52+
args: [true, "LSTM only"],
53+
useful: true
54+
}
55+
];
4956
}
5057

5158
/**

0 commit comments

Comments
 (0)