Skip to content

Documentation for clean_blank_images

Path: image_utils/clean_blank_images.py

Functions

analyze_image_gray_percentage

Analyze the percentage of pixels similar to target gray in an image using sampling.

Args: image_path (str): Path to the image file target_gray (tuple): Target gray RGB values to match tolerance (int): Tolerance for color similarity sample_rate (float): Fraction of pixels to sample (0.1 = 10%)

Returns: tuple: (image_path, percentage of pixels similar to target gray)

early_termination_check

Quick check on a small sample to see if an image might exceed the threshold.

Args: image_path (str): Path to the image file target_gray (tuple): Target gray RGB values to match tolerance (int): Tolerance for color similarity threshold (float): Percentage threshold for gray pixels check_size (int): Number of pixels to check initially

Returns: bool: True if the image needs full analysis, False if it can be skipped

process_file

Process a single file with early termination check.

process_directory

Process all image files in a directory using multiple processes with optimized analysis.

main

No description provided.