[Python] Extract text from image using pytesseract

Discussão em 'Python' iniciado por Stack, Fevereiro 18, 2025.

  1. Stack

    Stack Membro Participativo

    I want to extract text from the following image using Python:

    [​IMG]

    I tried with below codes but it's throwing an error:

    import pytesseract
    from PIL import Image
    img=Image.open(r'gif file path')
    pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-
    OCR/tesseract'

    r=pytesseract.image_to_string(img)
    print(r)

    And

    from PIL import Image
    from pytesseract import image_to_string
    img=Image.open('gif file path')
    text=image_to_string(img)
    print(text)


    Error:


    TesseractNotFoundError.
    ​

    Please help any way to get the text using Python.

    Note: pytesseract is already installed.

    Continue reading...

Compartilhe esta Página