I am new to python and I am using python 3.4.3 and Pillow for reading text from image. Image has white background with text in black.
The problem is when I am re-sizing image("captcha1.png") with MS Paint and using tesseract to read the text, everything works fine. But when I am re-sizing image with python(using pillow, code following), nothing happens.
im1 = Image.open("captcha1.png")
width, height = im1.size
im2 = im1.resize((int(width*5), int(height*5)), Image.ANTIALIAS)
im2.save("captcha2.png", dpi=(600.0,600.0))
I also tried
im2.save("captcha2.png", quality=95)
Using following to parse image:-
subprocess.call(['C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe', 'G:\\python\\captcha2.png', 'out', '-psm', '8'])
If I see image properties of re-sized images by Paint and python, both seem same (i.e. of 96dpi, same dimensions, sizes differ by ~2kb though).
Can someone help?
Also, I did a little bit of research and it seems 96dpi is too small for OCR, but I can't figure out why is everything working fine with image re-sized with paint?