(f, filename, ext)
| 986 | |
| 987 | def image_integrity(output_dir): |
| 988 | def verify_image(f, filename, ext): |
| 989 | try: |
| 990 | with Image.open(f) as img: |
| 991 | img.verify() |
| 992 | except Exception: |
| 993 | dest_dir = os.path.join(results_folder, "image_integrity") |
| 994 | os.makedirs(dest_dir, exist_ok=True) |
| 995 | shutil.copy(f, os.path.join(dest_dir, filename)) |
| 996 | prGreen(f"[INTEGRITY] Corrupted or suspicious image: {filename}") |
| 997 | |
| 998 | for ext in ["png", "jpg"]: |
| 999 | dir_path = os.path.join(output_dir, ext) |