title: How to extract data from an image accurately? Using PyTesseract
body: <p>I am trying to extract text from an image accurately using python.</p>
  
  <p>This is the image I am using in this scenario:</p>
  
  <p><a href="https://i.stack.imgur.com/v3W6F.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v3W6F.jpg" alt="Image 1"></a></p>
  
  <p>This is my python file:</p>
  
  <pre><code>from PIL import Image
  import pytesseract
  
  pytesseract.pytesseract.tesseract_cmd = r'C:\Users\test\AppData\Roaming\Python\Python37\site-packages\tesseract.exe'
  
  img=Image.open('C:/Users/test/Desktop/Everything else/work/Almonds.jpg')
  
  text = pytesseract.image_to_string(img, lang = 'eng')
  
  
  print(text)
  </code></pre>
  
  <p>And this is the output when I run the python file on Command Prompt:</p>
  
  <pre><code>INGREDIENTS: Almonds: [Nuts] Allergy Advice:
  For allergens, see ingredients in Bold
  
  Nutritional Information
  TYPICALVALUES Per 100g
  
  Energy kJ 2597.0}
  Energy kcal 626.0)
  Fat 50.6g|
  
  of which Saturates 3.9g
  
  Carbohy drate 19.7g
  
  of which Sugars 4.89|
  Fibre 3.59
  Protein 21.3g|
  
  May contain traces of
  other nuts, peanut,
  sesame or gluten
  
  This product may contain
  pieces of shell
  
  Store in a cool dry place
  jout of direct sunlight
  
  Net weight:
  
  
  
  Salt 0.ig
  
  For Best Before &amp; Batch see pack 1 k
  </code></pre>
  
  <p>As you see not all text is spelled correctly. Is there any recommendations to improve the text output accuracy?</p>
  
  <p><strong>EXTRA</strong></p>
  
  <p>Here is an idea of what I am trying to achieve, irrelevant to the question but  give you an idea of what I am trying to achieve here.</p>
  
  <p>I have multiple image files of products where I will compare to an excel sheet.</p>
  
  <p>Excel sheet is formatted in the following way (1 example data):</p>
  
  <pre><code>Product Code: 0001
  Product Desc: Californian Whole Almonds
  Ingredients: Almonds: [Nuts]
  Allergy Advice: True
  etc...
  </code></pre>
  
  <p>Then I will code a script which will detect the text within the image file, compare it to an excel sheet and analyse each sections if they match up together, giving outputs of 'True' or 'False'</p>