I am doing Tesseract-OCR for Image ('test.jpg'). After ran the below code (OCR) part i am saving the Extracted string into "OUTPUT.txt". Now i want to Archive the Image ("test.jpg") can you please help me?
file='test.jpg'
def ocr(file):
foo = Image.open(file)
print(foo.size)
foo = foo.resize((2000,3000),Image.ANTIALIAS)
pytes=pytesseract.image_to_string(foo)
with open("OUTPUT.txt","w") as file:
file.write(str(pytes))
print(pytes)
ocr(file)
import os
from shutil import copyfile
archive_path = "path to your archive folder"
if not os.path.exists(archive_path):
os.makedirs(arichive_path)
copyfile("test.jpg", archive_path)