{"id":29958320,"url":"https://github.com/abhaybraja/passport-cropper","last_synced_at":"2025-08-03T20:11:40.667Z","repository":{"id":307964548,"uuid":"1031212112","full_name":"abhaybraja/passport-cropper","owner":"abhaybraja","description":"Automatically detects and crops a face from an image to generate a passport-style photo from uploaded image. Ensures correct orientation, centers the face, and optionally compresses the image to stay within a specified file size (e.g., under 100KB). Ideal for scanned documents, selfies, or batch passport photo generation.","archived":false,"fork":false,"pushed_at":"2025-08-03T09:56:08.000Z","size":2712,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-03T11:20:33.748Z","etag":null,"topics":["cropper","face-detection","image-processing","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abhaybraja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-08-03T09:00:10.000Z","updated_at":"2025-08-03T09:57:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"a8e1884b-b3f4-4066-bbf9-ece632983068","html_url":"https://github.com/abhaybraja/passport-cropper","commit_stats":null,"previous_names":["abhaybraja/passport-cropper"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/abhaybraja/passport-cropper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhaybraja%2Fpassport-cropper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhaybraja%2Fpassport-cropper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhaybraja%2Fpassport-cropper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhaybraja%2Fpassport-cropper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abhaybraja","download_url":"https://codeload.github.com/abhaybraja/passport-cropper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhaybraja%2Fpassport-cropper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268534712,"owners_count":24265699,"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","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cropper","face-detection","image-processing","python"],"created_at":"2025-08-03T20:11:35.337Z","updated_at":"2025-08-03T20:11:40.658Z","avatar_url":"https://github.com/abhaybraja.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Passport Cropper 🪪📷\nAutomatically crop passport-style photos from scanned forms or images using face detection and image orientation correction.. Ensures correct orientation, centers the face, and optionally compresses the image to stay within a specified file size (e.g., under 100KB). Ideal for scanned documents, selfies, or batch passport photo generation.\n\nThis tool detects a face in a scanned form (even if rotated), intelligently crops the surrounding area to form a clean passport-size photo, and optionally compresses it to stay under a specified file size.\n\n---\n\n## ✨ Features\n\n- 🧠 Face detection using OpenCV\n- 📐 Intelligent orientation correction (handles rotated/scanned forms)\n- ✂️ Crops a clean passport-style image around the face\n- 💾 Automatically resizes/compresses image under a max file size (optional)\n- 🛠️ Easy to use as a library or script\n- 🐍 Open Source and available on PyPI\n\n\n## 📦 Installation\n\n```bash\npip install passport-cropper\n````\n\n---\n\n## 🧑‍💻 Usage\n\n```python\nfrom passport_cropper import crop_passport_photo\n\n# Crop and save image from scanned form\ncropped = crop_passport_photo(\n    image_path=\"admission_form.jpg\",\n    output_path=\"passport_photo.jpg\",\n    max_size_kb=100   # Optional - limit output image size\n)\n# No face detected if cropped is None.\n\nif cropped:\n  print(\"Image processed successfully!\")\n```\n\nYou can also run it directly as a script (CLI version coming soon):\n\n```bash\npython -m passport_cropper path/to/form.jpg\n```\n\n---\n\n## 🖼️ Input / Output Example\n\n**Input:**\nScanned or mobile photo of an admission form (rotated, tilted, or normal)\n\n**Output:**\nClean, upright, passport-style photo of the face cropped and optionally compressed.\n\n---\n\n## 📁 Project Structure\n\n```\npassport_cropper/\n├── passport_cropper/\n│   ├── __init__.py\n│   └── cropper.py\n├── examples/\n├── README.md\n├── LICENSE\n├── setup.py\n├── requirements.txt\n```\n\n---\n\n## ⚙️ Parameters\n\n| Parameter     | Type  | Description                                  |\n| ------------- | ----- | -------------------------------------------- |\n| `image_path`  | `str` | Path to the input image                      |\n| `output_path` | `str` | Path to save the cropped passport image      |\n| `max_size_kb` | `int` | (Optional) Max size (in KB) for output image |\n\n---\n\n## 🔧 Requirements\n\n* Python 3.7+\n* OpenCV\n\nInstall via:\n\n```bash\npip install -r requirements.txt\n```\n\n---\n\n## 🛡️ License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n\n## 🙌 Contributing\n\nPull requests are welcome! If you find a bug or want a new feature, feel free to [open an issue](https://github.com/abhaybraja/passport-cropper/issues) or submit a PR.\n\n---\n\n## 🌐 Links\n\n* 📦 PyPI: [https://pypi.org/project/passport-cropper](https://pypi.org/project/passport-cropper)\n* 💻 GitHub: [https://github.com/abhaybraja/passport-cropper](https://github.com/abhaybraja/passport-cropper)\n\n---\n\n## ✍️ Author\n\nDeveloped with ❤️ by [Abhay Braja](https://github.com/abhaybraja)\n\n```\nLet me know if you'd like me to insert your actual name and GitHub username, or generate a minimal working CLI wrapper too.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhaybraja%2Fpassport-cropper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabhaybraja%2Fpassport-cropper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhaybraja%2Fpassport-cropper/lists"}