MCPcopy Index your code
hub / github.com/LCBOWER33/StegoScan / image_integrity

Function image_integrity

StegoScan.py:987–1006  ·  view source on GitHub ↗
(output_dir)

Source from the content-addressed store, hash-verified

985
986
987def 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)
1000 if os.path.isdir(dir_path):
1001 files = [f for f in os.listdir(dir_path) if os.path.isfile(os.path.join(dir_path, f))]
1002 with ThreadPoolExecutor(max_workers=os.cpu_count() - 1) as executor:
1003 for filename in tqdm(files, desc=f"Image integrity {ext.upper()} test: "):
1004 f = os.path.join(dir_path, filename)
1005 executor.submit(verify_image, f, filename, ext)
1006 prGreen("IMAGE INTEGRITY TEST DONE")
1007
1008
1009def object_detection(output_dir):

Callers 2

start_progressFunction · 0.85
mainFunction · 0.85

Calls 1

prGreenFunction · 0.85

Tested by

no test coverage detected