How the text is recognised
Recognition happens in two stages, using models from the open-source PaddleOCR project. The first, a text detector called PP-OCRv5, looks at the whole image and marks every region that contains a line of text. It works on images in any layout: a single caption, a dense page, or text scattered over a photo. If the picture is slightly tilted, the image is straightened by the average slant of the lines it found.
Each line is then cut out, scaled to a fixed height and read by PP-OCRv6, a recognition model with a vocabulary of about 18,000 characters. The model reads the whole line at once rather than letter by letter, so it uses context: a character that is ambiguous on its own, such as 0 or O, is usually resolved by the characters around it. Lines with very low confidence that consist of only one or two characters are dropped, which removes most of the specks and edges that a photo can contain.
Putting the text in order
The recognised lines are arranged in reading order. Lines that sit at the same height belong to one row and are joined from left to right; rows are listed from top to bottom. A gap between two rows that is clearly larger than the normal line spacing starts a new paragraph. If you choose to join lines into paragraphs, wrapped lines are joined with a space, Chinese and Japanese lines without one, and a word split by a hyphen at the end of a line is put back together.
Tips for better results
Use the sharpest image you have: a screenshot is better than a photo of a screen, and a photo taken straight on in good light is better than one at an angle. If the text is small, zoom in before you take the screenshot. Crop away anything that is not text with the crop tool, and turn multi-column pages into one image per column. To keep the original images together with the text, combine them into a document with JPG to PDF.