title: How do I convert local .JPG file to Base64 to work with Boto3 and Detect_Text?
body: <p>Relevant Code:</p>
  
  <pre><code>import boto3
  from PIL import Image
  import base64
  
  client = boto3.client('rekognition')
  
  filename = r'C:\Users\H-63\Pictures\scantests\Rekognition test.JPG'
  
  with open(filename, 'rb') as image_file:
      image = image_file.read()
  
  image = base64.b64encode(image).decode('UTF-8')
  
  response = client.detect_text(
      Image={'Bytes': image
          })
  </code></pre>
  
  <p>However,
  When I run this, I get an error:</p>
  
  <pre><code>An error occurred (InvalidImageFormatException) when calling the DetectText operation: Request has Invalid image format
  </code></pre>
  
  <p>How do I get my image to be the right format for detect_text? The documentation says it has to be base64 encoding. </p>