0

I am using pyautogui to take screenshot of a certain area.

img = pyautogui.screenshot(region=(width - 75, length - 181, 190, 27))

Now I can successfully it into string.

pytesseract.image_to_string(img)

But I want to upscale the image to 400% before converting to string. Using cv2 has some compatibility issues maybe because it is a PIL image. Is there any alternative to do that with few lines of code?

Ali Sajjad
  • 3,589
  • 1
  • 28
  • 38
  • What is the issue, exactly? Have you tried anything, done any research? Please see [ask], [help/on-topic]. – AMC Apr 15 '20 at 19:48
  • Does this answer your question? [How do I resize an image using PIL and maintain its aspect ratio?](https://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio) – AMC Apr 15 '20 at 19:48

1 Answers1

2

Just use PIL/Pillow's resize():

from PIL import Image

....
....
img = img.resize((newX, newY))
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • https://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio – AMC Apr 15 '20 at 19:48