😫 Vấn đề (The Pain Point)
Khách hàng gửi file Word chèn đầy hình ảnh sản phẩm bên trong. Bạn cần lấy các ảnh đó ra để up lên web. Cách thông thường: Click chuột phải từng ảnh -> “Save as Picture”. Nếu có 50 ảnh thì rất mệt.
🚀 Giải pháp Agentic (The Solution)
Tool “đào” vào cấu trúc file và lôi tất cả mọi thứ là hình ảnh ra ngoài folder.
Tính năng:
- Original Quality: Lấy đúng file ảnh gốc được chèn vào, không bị nén hay giảm chất lượng như khi chụp màn hình.
- Support All: Hỗ trợ cả
.docxvà.pdf.
🤖 Engineering Prompt (Copy & Paste)
**Role:** Python Forensics Developer
**Task:** Create a tool to "Extract Images from Documents".
**Requirements:**
1. **Tech Stack:** Python, `tkinter`, `pypdf`, `python-docx`.
2. **GUI:**
* Select File (PDF or DOCX).
* Select Output Folder.
* Extract button.
3. **Logic:**
* **PDF:** Use `pypdf` image extraction method (iterating xObjects resources).
* **DOCX:** A `.docx` file is actually a ZIP. Open it as zip, find `word/media/` folder, extract contents. OR use `docx` library. The ZIP method is more robust for just getting images.
* Save images to output.
4. **Deliverables:**
* `doc_img_extractor.py`
* `run.bat`
* `requirements.txt`
**Context:** Designers retrieving assets from client briefs.
🧠 Giải mã Prompt
- DOCX is ZIP: File Word thực chất là một file nén. Nếu đổi đuôi
.docxthành.zipvà giải nén, bạn sẽ thấy foldermediachứa ảnh. Prompt gợi ý AI dùng cách này (hoặc thư viện tương đương) để lấy ảnh nhanh nhất.
🛠️ Hướng dẫn
- Copy Prompt -> Paste.
- Chạy
run.bat. - Chọn file Word -> Extract -> Nhận folder đầy ắp ảnh.