Raise MinImagePoints from the default 24 points to read “Warehouse inventory” but skip “Shipping department” in the zip’s labels.pdf.
dotnet add package RecursiveAI.OneOcr.PdfRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using OneOcr; using OneOcr.Pdf; var engine = OcrEngine.LoadBundled(); var options = new PdfOcrOptions { MinImagePoints = 36 }; var page = PdfOcr.Read( "labels.pdf", engine, options)[0]; Console.WriteLine(page.ToText());
Unzip the example, then dotnet run.
Prints only the words from the larger image:
Warehouse inventoryThe full program
A point is 1/72 inch on the page, so 36 points is half an inch. The two images are each about 312 points wide. The inventory image is 48 points tall, and the department label is 32 points tall. There’s no selectable text on the page. The program reads it twice, changing only the minimum image size.
using OneOcr; using OneOcr.Pdf; var engine = OcrEngine.LoadBundled(); foreach (int points in new[] { 36, 24 }) { var options = new PdfOcrOptions { MinImagePoints = points }; var page = PdfOcr.Read("labels.pdf", engine, options)[0]; Console.WriteLine($"Minimum: {points} points"); Console.WriteLine(page.ToText()); foreach (var note in page.Diagnostics) Console.WriteLine(note); }
Minimum: 36 points Warehouse inventory OCR301: 1 regions were read from pixels at 300 DPI (2 words). Minimum: 24 points Warehouse inventory Shipping department OCR301: 2 regions were read from pixels at 300 DPI (4 words).
If a label you need goes missing, try lowering the cutoff. Even a wide image is skipped if its height is below the minimum.
Related recipes
The short answer
Set PdfOcrOptions.MinImagePoints when you call PdfOcr.Read. An embedded image needs to meet the minimum in both width and height to be considered for image OCR. In the sample, raising the cutoff from the default 24 points to 36 keeps the 48-point-tall scan but skips the 32-point-tall label. Nothing is removed from the PDF.
How do I skip small embedded images during PDF OCR?
Measure an image by its displayed size on the page, not by its stored pixel dimensions. OneOcr checks the image’s on-page bounds after clipping them to the page. At a cutoff of 36 points, an image exactly 36 points tall passes the size check if it’s also at least 36 points wide. Raising RenderDpi doesn’t turn an undersized placement into a larger one: it changes how the page is rendered to pixels, not the bounds used by the size check.
Passing the size check doesn’t mean the image is always read. The PDF bridge also checks whether accepted text on the page already covers it. If you’re testing a threshold, compare the actual returned words on a few pages with the original so you catch any labels or stamps you meant to keep.
Can I skip a logo printed inside a full-page scan?
Not with this size setting alone. If the logo and the body text are in the same full-page image, the bridge sees one placed image, not a separate small logo. The threshold tests the size of that full image. It also doesn’t filter selectable PDF words by font size or filter the words recognized within an image by the size of their boxes.
For a document template with separately embedded logos and a larger scan, this cutoff is useful when the placements have distinct sizes. For a flattened scan, use the returned word boxes to decide which recognized text to keep based on where it appears on the page. That filters the result after recognition; it doesn’t stop the recognizer from seeing those pixels.