I am trying to automate PDF blank page removal in batch processing. I need to process very large amount of pdf files and need to get rid of all blank pages with very less chance of errors( errors like blank page left and content page deletion). I am new to such algorithms, currently I am trying new approaches. here is the one I am currently using: def is_blank(image, threshold=0.01): try: gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) _, threshed = cv2.threshold(gray, 245, 255, cv2.THRESH_BINARY) non_white_ratio = 1 - (cv2.countNonZero(threshed) / (image.shape[0] * image.shape[1])) return non_white_ratio < threshold except Exception as e: print(f"Error in is_blank: {e}") return False It would be very helpful and kind of you to guide me in the process of finding optimal PDF blank page removal algorithm. Continue reading...