MCPcopy Create free account
hub / github.com/LCBOWER33/StegoScan / extract_images_from_docx

Function extract_images_from_docx

StegoScan.py:586–596  ·  view source on GitHub ↗
(docx_path, output_dir)

Source from the content-addressed store, hash-verified

584
585
586def extract_images_from_docx(docx_path, output_dir):
587 doc = Document(docx_path)
588 count = 0
589 for i, rel in enumerate(doc.part.rels):
590 if "image" in doc.part.rels[rel].target_ref:
591 image = doc.part.rels[rel].target_part.blob
592 image_path = os.path.join(output_dir, f'image_{count + 1}.png')
593 with open(image_path, "wb") as f:
594 f.write(image)
595 count += 1
596 # print(f"Extracted {count} images from {docx_path}")
597
598
599def extract_from_file(output_dir):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected