阅读文本 / Reading text
This paper uses synthetic samples to demonstrate the processing method. The code has been verified using examples in an isolated environment; this does not guarantee effectiveness for all real files or products. Before processing important files, please retain the original copies and verify them against the boundaries and acceptance criteria outlined in this document.
Opening a hundred-page scan one page at a time is very slow, and skipping to the first page risks missing inverted, blank, or duplicate pages. A thumbnail overview is suitable for initially identifying broad anomalies, but it cannot replace detailed checks of small text, monetary amounts, and seals. When creating an overview, the most important thing is to maintain the correspondence between page numbers and the original document.
thumbnails maintain their aspect ratio and do not stretch all pages to the same size
uses
ImageOps.contain
can shrink the image within a given frame while maintaining its aspect ratio, then place it into a fixed-size card. The distinction between landscape and portrait orientations should be preserved; otherwise, the overview might obscure page orientation anomalies. Page-number labels are added by the system and do not interfere with the original page content.
constructs a two-page traceable overview
from PIL import Image, ImageOps, ImageDraw
pages = [Image.new("RGB", (100, 200), "white"),
Image.new("RGB", (200, 100), "#dddddd")]
sheet = Image.new("RGB", (240, 160), "#eeeeee")
draw = ImageDraw.Draw(sheet)
manifest = []
for index, page in enumerate(pages):
thumb = ImageOps.contain(page, (100, 120))
x = index * 120 + (120 - thumb.width) // 2
sheet.paste(thumb, (x, 5))
draw.text((index * 120 + 10, 140), f"Page {index + 1}", fill="black")
manifest.append({"page": index + 1, "source_size": page.size,
"thumb_size": thumb.size, "column": index})
assert sheet.size == (240, 160)
assert manifest[0]["thumb_size"] == (60, 120)
assert manifest[1]["thumb_size"] == (100, 50)
assert [row["page"] for row in manifest] == [1, 2]
assert pages[0].size == (100, 200)
code generates a memory map without writing to disk or invoking an identification service. In a real-world batch, multiple overviews should be generated by page groupings to avoid cramming thousands of thumbnails onto a single massive canvas. Ideally, tags should also be linked to the source file IDs to prevent confusion among the first pages of multiple files.
Overview is responsible for discovering what
can quickly detect
is not suitable for being judged solely based on thumbnails
Next step
Large-area blank space
Whether the light-colored annotations have been omitted
opens the original image
direction is clearly abnormal
Does a small-angle tilt affect recognition?
View the local results and OCR results
page shape undergoes a sudden change
Is the content missing lines?
compared with the original page number
suspected duplicate page
Two-page minor revision
compares the original image with the text
marks the anomaly instead of automatically deleting
Blank pages may serve as chapter separators, and repeated appearances could correspond to signature pages of different versions. The overview is only responsible for flagging ambiguities to the reviewer and should not automatically delete pages that “do not appear to contain useful content.” The final delivery must still specify the correspondence between input pages and output content.
first inspects the input, then reviews the translation
uses
OmniDoc (Product Entry)
Before processing long scanned documents, conducting a preliminary overview inspection can help detect input issues earlier. After translation, reviewing the abnormal pages and high-risk fields is more targeted than examining only the first few pages. The overview provides direction, while the original images and bilingual content serve as the basis for the final judgment.
Reference:
Pillow ImageOps.contain
。
- 1 -
Updated 2026-10-08