import cv2
import pickle

with open('unique_pages.pkl', 'rb') as f:
    unique_pages = pickle.load(f)

import os
out_dir = r"C:\Users\Certes\.gemini\antigravity\brain\975cea00-dd68-4689-9ee3-f1a2408b4ee6\pages"
os.makedirs(out_dir, exist_ok=True)

for i, p in enumerate(unique_pages):
    cv2.imwrite(os.path.join(out_dir, f"page_{i:03d}.png"), p)

print(f"Saved {len(unique_pages)} pages to {out_dir}")
