ok, so here is my probleme, i have a lot of jpg files, that is a text about plant and all stuff, and there is images with it that i'm not interested in, so i would like to detect them, then to fill the image with white, so text recognition that i'll make after will not detect the images. However, i'm kinda new to manipulating jpg with python and i have no clue about how do i do that. If it's unclear, feel free to ask question, and sorry for poor gramar, i'm French. Here is a good exemple of a page with image and text, where i want to get rid of the image
from PIL import Image
import os
savePath = "C:/Users/33641/Downloads/stage/codes/ImgDeleted/" #path of folder where i would like to save them
def DelImg(path, imgSavePath, name):
if not os.path.exists(imgSavePath):
os.makedirs(imgSavePath)
im = Image.open(path)
#check if it contains an image
#if so, fill it with blank
im.save(imgSavePath+name)
path = "C:/Users/33641/Downloads/stage/codes/Cropped" #path of folder that contains images
for i in range(len(os.listdir(path))): #explore all my folder that contains images
path2 = "C:/Users/33641/Downloads/stage/codes/Cropped/" + os.listdir(path)[i]
for j in range(len(os.listdir(path2))): #explore all images and send them to the function
DelImg("C:/Users/33641/Downloads/stage/codes/JPEG/" + os.listdir(path)[i]+"/"+os.listdir(path2)[j], savePath+os.listdir(path)[i], "/"+os.listdir(path2)[j])
print(str(i)+ "/"+str(len(os.listdir(path))))