From 1a08052aef07d3aa17f01f5bdf5f31dcdd2273fb Mon Sep 17 00:00:00 2001 From: Chris kerr Date: Wed, 11 Jun 2025 16:55:38 -0400 Subject: [PATCH] remove fix file i used to fix transparancy layers --- robohash/fix.py | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 robohash/fix.py diff --git a/robohash/fix.py b/robohash/fix.py deleted file mode 100644 index de69787..0000000 --- a/robohash/fix.py +++ /dev/null @@ -1,47 +0,0 @@ -from PIL import Image -import os - -def aggressive_fix_all_images(folder_path): - problem_files = [] - - for root, dirs, files in os.walk(folder_path): - for file in files: - if file.endswith('.png') and not file.startswith('temp_'): - filepath = os.path.join(root, file) - try: - img = Image.open(filepath) - - # Force convert ALL images to clean RGBA, regardless of current mode - print(f"Processing {file} (Mode: {img.mode})") - - # Create a new clean RGBA image - new_img = Image.new('RGBA', img.size, (0, 0, 0, 0)) - - # Convert source to RGBA first - if img.mode != 'RGBA': - if img.mode == 'P': - # Handle palette images specially - img = img.convert('RGBA') - elif img.mode in ['RGB', 'L', 'LA']: - img = img.convert('RGBA') - - # Paste onto clean background - new_img.paste(img, (0, 0), img) - - # Save without any optimization that might cause issues - new_img.save(filepath, 'PNG', optimize=False, compress_level=1) - print(f" āœ“ Fixed {file}") - - except Exception as e: - print(f" āŒ Error with {file}: {e}") - problem_files.append(filepath) - - if problem_files: - print("\nProblem files that couldn't be fixed:") - for f in problem_files: - print(f" {f}") - else: - print("\nāœ“ All files processed successfully!") - -# Run the aggressive fix -aggressive_fix_all_images("C:/code/Robohash/robohash/sets/set6") \ No newline at end of file