../
  1. Part 1: Tesseract and Image Quality
  2. Part 2: Tesseract and Image Dimensions (this post)
  3. Part 3: Tesseract and Image Rotation

TLDR Summary

Unlike the JPG image quality setting discussed in the previous post, the size of the image and the size of the text has a huge impact on using Tesseract for OCR.

Results

text size image Tesseract results Comments
6 pt  
  1. no text detected
8 pt egnts and treedons tn canede he Canadian charter of #Ughts and Freedens qurantees the Fights and Freed Set sat"ta Cesubject ony te Sen reasonabe Lunt prescribed by'taw 36 can be ‘Svanstvantyustitted the tree and dancratve Soctety (2) frendon of conscience and religion, £8) FESR Se OGLE totnan ne expression, [Sy Fresdon Bf seacefat sszerstys and (GG) fresan Sr Sececieess fey tien of ands fas the right ta vt oa feyientce Scent Egle Fr ner sip
  1. some words detected, but text is illegible
10 pt Rights and freedons in canada The Canadian charter of Rights and Freedons guarantees the rights and freedons set out in Ut subject only to such reasonable Lintts prescribed by law as can be denonstrably Justtfted tn a free and denocrattc sectety. Fundamental freedoms Everyone has the following fundamental. freedons: (2) freedom of conscience and religion: (b) freedom of thought, belief, opinion and expression, including freedom of the press’ and other nedta of conmuntcat ton (c) freedom of peaceful assembly; and (@) freedom of association. Denocratic rights of citizens Every citizen of Canada has the right to vote in an election of menbers of the House of Connons or of @ Legislative assenbly and to be qualified for nenbership theretn.
  1. most of the text can be read
  2. 29 differences from original text
14 pt Rights and freedoms in Canada The Canadian Charter of Rights and Freedons guarantees the rights and freedons set out in it subject only to such reasonable limits prescribed by Law as can be demonstrably justified in a free and denocratic society. Fundanental freedoms Everyone has the following fundamental freedons: (a) freedom of conscience and religion; (b) freedom of thought, belief, opinion and expression, including freedom of the press and other media of connunication; (c) freedom of peaceful assembly; and (d) freedom of association. Democratic rights of citizens Every citizen of Canada has the right to vote in an election of members of the House of Commons or of a legislative assembly and to be qualified for membership therein.
  1. 8 minor differences from original text
20 pt Rights and freedoms in Canada The Canadian Charter of Rights and Freedoms guarantees the rights and freedoms set out in it subject only to such reasonable limits prescribed by law as can be demonstrably justified in a free and democratic society. Fundamental freedoms Everyone has the following fundamental freedoms: (a) freedom of conscience and religion; (b) freedom of thought, belief, opinion and expression, including freedom of the press and other media of communication; (c) freedom of peaceful assembly; and (d) freedom of association. Democratic rights of citizens Every citizen of Canada has the right to vote in an election of members of the House of Commons or of a legislative assembly and to be qualified for membership therein.
  1. no differences (other than whitespace)

Taking an image with a small font and resizing it helps marginally.

For example, here is the 8pt image upscaled to be the same size as the 20 pt image. The results aren't as nice as CSI would have you believe, but the text has gone from being mostly illegible to definitely readable:

size image Tesseract results
8 pt, scaled 200% Rights and freedons in Canada The Canadian Charter of Rights and Freedons guarantees the rights and freedoms set ovt in (t subject only to such reasonable Limits prescribed by law as can be deronstrably justifled tn a free and democratic soctety. Fundanental freedons Everyone has the following fundamental freedoms: (a) freedon of conscience and religton; (b) freedon of thought, beltef, opinion and expression, including freedon of the press and other nedia of communication; (c) freedon of peaceful assenbly; and (d) freedon of assoctation. Derocrattc rights of citizens Every citizen of Canada has the right to vote in an election of menbers of the House of Cornons or of a legislative assembly and to be qualified for nenbership therein.

There are limits to what can be scaled.

Here you can see the image with the 6 pt font scaled up to match the dimensions of the 20 pt font. While the text layout was captured by Tesseract, the actual text content contains enough errors to make the text unusable:

size image Tesseract results
6 pt, scaled 300% Bights ard freedons tn Canede The Conpdion Charter of mLghts aed Freedans guarantees the FLghtS aed Frendans set out la Lt subject aaly to Soh Cenconaale LIALts preserloed by Law a6 Can be demerstrably Justified La a free aed denecratlc coclety. Furdanental freedons Deerpove bas Ube following ferdevertal freedans: (a) freeden of cancclence aed religtes; (2) freedan of thought, Belief, aplatar aed sapresctan, Leclediag freedas of the prece and other nedle of canmuatcation; (c) freedan of peaceful accendly; and (4) freedan of acoactatias. Oenocrattc rights of cite Deere CUULes Of Conmde Ras Ube Fight te vate La ay clect lon of members of Use House of Comers of of Lealslatlee asserbly ant te be qual ifled for menberstie Uereta,

Continue reading with part 3, Tesseract and Image Rotation.

Last modified: 2022-03-28
Stéphane Charette, stephanecharette@gmail.com
../