Opening Image file from url with PIL for text recognition with pytesseract
I am facing a confusing problem trying to download image and open it with BytesIO in order to extract text from it using PIL & pytesseract. >>> response = requests.get('http://abc/images/im.jpg') >>> img = Image.open(BytesIO(response.content)) >>> img <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=217x16 at 0x7FDAD185CB38> >>> text = pytesseract.image_to_string(img) >>> text '' Here it gives an empty string. However if i save the image and then open it again with pytesseract, it gives the right result. >>> img.save('im1.jpg') >>> im = Image.open('im1.jpg') >>> pytesseract.image_to_stri
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.