📄

Lấy ảnh từ file Word/PDF

Trích xuất toàn bộ hình ảnh gốc đang được nhúng trong file Word hoặc PDF ra thành file ảnh riêng lẻ.

Document ⭐⭐ Intermediate ⏱️ 5 phút

😫 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ả .docx.pdf.

Extract Images Screenshot

🤖 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 .docx thành .zip và giải nén, bạn sẽ thấy folder media chứ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

  1. Copy Prompt -> Paste.
  2. Chạy run.bat.
  3. Chọn file Word -> Extract -> Nhận folder đầy ắp ảnh.

Workflows liên quan

Khám phá danh mục khác

📬

Get Started with Agentic Working

Subscribe to receive updates from AgenticWorking.io

📖 Free eBook Guide 📦 7 Ready-to-use Scripts 🔔 Weekly Tips

No spam, unsubscribe anytime. Join 1,000+ subscribers.