cap_to_text - Linux


cap_to_text converts text from a CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) image to plain text. It utilizes image processing techniques and machine learning algorithms to extract characters from the image, helping to bypass CAPTCHAs and automate web scraping or other tasks.


cap_to_text [OPTIONS] <image_file>


  • -h, –help: Display usage information and exit.
  • -v, –version: Display version information and exit.
  • -o, –output: Specify output file path for the extracted text. By default, prints text to standard output.
  • -a, –accuracy: Adjust character recognition accuracy level (0-100). Higher values increase accuracy but slow down processing. Default: 90.
  • -t, –timeout: Set a timeout (in seconds) for the recognition process. Default: 30.
  • -i, –image-format: Specify image file format (jpg, png, etc.) if not automatically detected.
  • -m, –model: Choose the machine learning model for character recognition (default, neural, or tesseract). Default: default.


Extract text from a CAPTCHA image:

cap_to_text captcha.jpg

Save extracted text to a file:

cap_to_text -o output.txt captcha.jpg

Use higher accuracy with longer processing time:

cap_to_text -a 99 captcha.jpg

Common Issues

  • Inaccurate character recognition: Adjust --accuracy or try a different model (--model) for better results.
  • Timeout errors: Increase --timeout if the recognition process takes longer than expected.
  • Unsupported image formats: Use --image-format to specify the correct format if auto-detection fails.


Example Python script:

import subprocess

# Read image file
with open('captcha.jpg', 'rb') as f:
    image_bytes =

# Perform CAPTCHA recognition
output = subprocess.check_output(['cap_to_text'], input=image_bytes).decode()

Related Commands

  • tesseract: Another open-source tool for OCR (Optical Character Recognition), often used in combination with cap_to_text.
  • google-ocr: Google Cloud API for OCR.