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
  • 2,103
  • 17
  • 29
  • 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

0

Just use PIL/Pillow's resize():

from PIL import Image

....
....
img = img.resize((newX, newY))
Mark Setchell
  • 169,892
  • 24
  • 238
  • 370
  • 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