Why my image is in bad quality ?

Chris Angelico rosuav at gmail.com
Wed Dec 16 09:33:36 EST 2015


On Thu, Dec 17, 2015 at 1:21 AM,  <fsn761304 at gmail.com> wrote:
> I tried also another code (see below) and without scaling by 20 quality of recognition was very bad.
>
> from pytesseract import image_to_string
> from PIL import Image
>
> im = Image.open("screen.png")
> print(im)
> im = im.resize((214*20,26*20), Image.ANTIALIAS)
> print(image_to_string(im))

If you need to scale by 20x20 to get the text recognition to work, I
would recommend using something other than an anti-alias filter. Omit
the second argument to use a simpler algorithm; you'll get a blocky
result, which might parse more cleanly for you.

ChrisA



More information about the Python-list mailing list