Schematic
Schematic
new_img.save(output_path, "PNG")
logging.info(f"Saved image from {source}: {output_path}")
print(f"Saved image {counter}.png from {source}")
return True
except Exception as e:
logging.error(f"Error processing image {counter} from {source}: {e}")
print(f"Error processing image {counter} from {source}: {e}")
return False
# Method 1: Extract images using openpyxl
def extract_with_openpyxl():
global image_counter
try:
wb = openpyxl.load_workbook(excel_path)
ws = wb.active
logging.info("Excel file loaded successfully with openpyxl")
print("Excel file loaded successfully with openpyxl")
# Get all images
images = ws._images
logging.info(f"Found {len(images)} embedded images with openpyxl")
print(f"Found {len(images)} embedded images")
if not images:
logging.warning("No embedded images found with openpyxl")
print("No embedded images found with openpyxl")
return