{"id":26781527,"url":"https://github.com/shaukataliii/patwar-pdf-compressor","last_synced_at":"2025-07-03T09:33:59.658Z","repository":{"id":282026508,"uuid":"944441420","full_name":"Shaukataliii/patwar-pdf-compressor","owner":"Shaukataliii","description":"This project is a FastAPI-based service that extracts and compresses images from PDF files while ensuring: Each image is \u003c 300 KB, The total size of images \u003c 3 MB, Proportional compression is applied. This service returns the compressed images as a result.","archived":false,"fork":false,"pushed_at":"2025-04-15T02:05:28.000Z","size":2374,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T03:20:35.982Z","etag":null,"topics":["land-document","patwari","pdf-compression","pdf-compressor"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shaukataliii.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-07T10:54:39.000Z","updated_at":"2025-04-15T02:05:31.000Z","dependencies_parsed_at":"2025-04-15T03:20:03.304Z","dependency_job_id":"50c330af-692b-47a4-a1d9-a69178321a84","html_url":"https://github.com/Shaukataliii/patwar-pdf-compressor","commit_stats":null,"previous_names":["shaukataliii/patwar-pdf-compressor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Shaukataliii/patwar-pdf-compressor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shaukataliii%2Fpatwar-pdf-compressor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shaukataliii%2Fpatwar-pdf-compressor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shaukataliii%2Fpatwar-pdf-compressor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shaukataliii%2Fpatwar-pdf-compressor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shaukataliii","download_url":"https://codeload.github.com/Shaukataliii/patwar-pdf-compressor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shaukataliii%2Fpatwar-pdf-compressor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263301015,"owners_count":23445332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["land-document","patwari","pdf-compression","pdf-compressor"],"created_at":"2025-03-29T08:16:39.767Z","updated_at":"2025-07-03T09:33:59.629Z","avatar_url":"https://github.com/Shaukataliii.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📄 PDF Image Extractor \u0026 Compressor 🚀\n\nA FastAPI-based service to **extract and compress images** from PDFs while ensuring:  \n✅ Each image is **\u003c 300 KB**  \n✅ Total compressed images are **\u003c 3 MB**  \n✅ Adaptive, proportional compression for best quality  \n\n---\n\n## 🚀 Features  \n- **Extracts all images** from a PDF  \n- **Compresses images adaptively** to fit size constraints  \n- **Ensures quality preservation** while reducing file size  \n- **Returns a ZIP file** containing the compressed images  \n- **Fast \u0026 scalable** using FastAPI  \n\n---\n\n## 🛠️ Installation  \n\n### **1⃣ Clone the repository**\n```sh\ngit clone https://github.com/Shaukataliii/patwar-pdf-compressor\ncd patwar-pdf-compressor\n```\n\n---\n\n### Create a virtual environment (optional but recommended)\n```sh\npython -m venv venv\nsource venv/bin/activate   # On Windows: venv\\Scripts\\activate\n```\n\n### Install dependencies\n```sh\npip install -r requirements.txt\n```\n\n## ▶️ Usage\n\n### **1⃣ Run the FastAPI server**\n```sh\nuvicorn main:app --reload\n```\nBy default, the API runs at http://127.0.0.1:8000.\n\n### **2⃣ Use the API**\nGo to http://127.0.0.1:8000/docs to access Swagger UI.\nUse the `/process` endpoint to upload a PDF file.\n\n#### Example API Call (cURL)\n```sh\ncurl -X 'POST' 'http://127.0.0.1:8000/process' \\\n     -H 'accept: application/zip' \\\n     -H 'Content-Type: multipart/form-data' \\\n     -F 'file=@sample.pdf' \\\n     --output compressed_images.zip\n```\n\n## 📚 API Documentation\n\n### 🔹 POST /process\nUploads a PDF, extracts images, compresses them, and returns a ZIP file.\n\n#### Request\n- **Method:** POST\n- **URL:** /process\n- **Headers:** Content-Type: multipart/form-data\n- **Body:**\n  - `file` (PDF file)\n\n#### Response\n- **Success:** `200 OK` – Returns a ZIP file containing the compressed images.\n- **Errors:**\n  - `400 Bad Request` – If the file is not a PDF or has no images.\n  - `500 Internal Server Error` – If an unknown error occurs.\n\n## ⚙️ Tech Stack\n- **Python** 🐍\n- **FastAPI** 🚀\n- **PyMuPDF (fitz)** 📄 (for extracting images)\n- **Pillow (PIL)** 🎨 (for image processing)\n\n## 🤝 Contributing\nFeel free to contribute! Fork the repository and submit a pull request.\n\n## 🐟 License\nThis project is licensed under the MIT License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaukataliii%2Fpatwar-pdf-compressor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaukataliii%2Fpatwar-pdf-compressor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaukataliii%2Fpatwar-pdf-compressor/lists"}