{"id":25135189,"url":"https://github.com/netesh5/image_background_remover","last_synced_at":"2025-07-14T17:15:58.400Z","repository":{"id":274602644,"uuid":"923038124","full_name":"Netesh5/image_background_remover","owner":"Netesh5","description":"A Flutter package that removes the background from images using an ONNX model. The package provides a seamless way to perform image processing, leveraging the power of machine learning through ONNX Runtime.","archived":false,"fork":false,"pushed_at":"2025-03-27T09:58:46.000Z","size":34227,"stargazers_count":2,"open_issues_count":4,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T10:39:00.050Z","etag":null,"topics":["flutter","image-background","image-background-removal","image-processing","machine-learning","onnx","onnxruntime","remove-background","remove-background-image","removebg"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/image_background_remover","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Netesh5.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2025-01-27T14:40:10.000Z","updated_at":"2025-03-27T09:58:50.000Z","dependencies_parsed_at":"2025-01-28T10:25:09.489Z","dependency_job_id":"5600cb93-eeeb-4f6f-850a-e45e82411924","html_url":"https://github.com/Netesh5/image_background_remover","commit_stats":null,"previous_names":["netesh5/flutter_background_remover"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netesh5%2Fimage_background_remover","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netesh5%2Fimage_background_remover/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netesh5%2Fimage_background_remover/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netesh5%2Fimage_background_remover/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Netesh5","download_url":"https://codeload.github.com/Netesh5/image_background_remover/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246922247,"owners_count":20855345,"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":["flutter","image-background","image-background-removal","image-processing","machine-learning","onnx","onnxruntime","remove-background","remove-background-image","removebg"],"created_at":"2025-02-08T16:18:43.204Z","updated_at":"2025-04-03T02:15:25.207Z","avatar_url":"https://github.com/Netesh5.png","language":"Dart","funding_links":["https://www.buymeacoffee.com/neteshpaudel"],"categories":[],"sub_categories":[],"readme":"# Image Background Remover - Flutter\n## ⌗ Overview\nA Flutter package that removes the background from images using an ONNX model. The package provides a seamless way to perform image processing, leveraging the power of machine learning through ONNX Runtime. This package works completely offline without any external API dependencies\n\n---\n\n## 🌟 Features\n\n- Remove the background from images with high accuracy.\n- Works entirely offline, ensuring privacy and reliability.  \n- Lightweight and optimized for efficient performance.  \n- Simple and seamless integration with Flutter projects. \n- Add a custom background color to images.\n- Customizable threshold value for better edge detection.\n\n---\n\n## 🔭 Example\n\u003cimg src=\"https://github.com/user-attachments/assets/a306cec8-82eb-482a-92d4-d5d99603aebc\" alt=\"Overview\" width=\"300\" height=\"600\" /\u003e\n\n\n## Getting Started\n\n### 🚀 Prerequisites\n\nBefore using this package, ensure that the following dependencies are included in your `pubspec.yaml`:\n\n```yaml\ndependencies:\n  image_background_remover: ^latest_version\n  ```\n\n##  Usage\n# Initialization\nBefore using the `removeBg` method, you must initialize the ONNX environment:\n```dart\n    import 'package:image_background_remover/image_background_remover.dart';\n\n    @override\n    void initState() {\n        super.initState();\n        BackgroundRemover.instance.initializeOrt();\n    }\n```\n\n# Dispose\nDon't forget to dispose the onnx runtime session :\n```dart\n  @override\n  void dispose() {\n    BackgroundRemover.instance.dispose();\n    super.dispose();\n  }\n```\n\n# Remove Background\nTo remove the background from an image:\n``` dart\nimport 'dart:typed_data';\nimport 'package:image_background_remover/image_background_remover.dart';\n\nUint8List imageBytes = /* Load your image bytes */;\nui.Image resultImage = await BackgroundRemover.instance.removeBg(imageBytes);\n/* resultImage will contain image with transparent background*/\n\n```\n\n## 🆕 New Feature: Add Background Color\n\nYou can now add a custom background color to images after removing the background.\n\n### Usage:\n\n```dart\nUint8List modifiedImage = await BackgroundRemover.instance.addBackground(\n  image: originalImageBytes,\n  bgColor: Colors.white, // Set your desired background color\n);\n\n```\n\n## API\n\n### Methods\n\n| Method                          | Description                                                                 | Parameters                                      | Returns                           |\n|---------------------------------|-----------------------------------------------------------------------------|------------------------------------------------|-----------------------------------|\n| `initializeOrt()`               | Initializes the ONNX runtime environment. Call this method once before using `removeBg`. | None                                           | `Future\u003cvoid\u003e`                   |\n| `removeBg(Uint8List imageBytes, { double threshold = 0.5, bool smoothMask = true, bool enhanceEdges = true })` | Removes the background from an image.                                     | `imageBytes` - The image in byte array format. \u003cbr\u003e\u003cbr\u003e `threshold` - The confidence threshold for background removal (default: `0.5`). A higher value removes more background, while a lower value retains more foreground. \u003cbr\u003e\u003cbr\u003e `smoothMask` - Whether to apply bilinear interpolation for smoother edges (default: `true`). \u003cbr\u003e\u003cbr\u003e `enhanceEdges` - Whether to refine mask boundaries using gradient-based edge enhancement (default: `true`). | `Future\u003cui.Image\u003e` - The processed image with the background removed. |\n| `addBackground({required Uint8List image, required Color bgColor})` | Adds a background color to the given image. | `image` - The original image in byte array format. \u003cbr\u003e `bgColor` - The background color to be applied. | `Future\u003cUint8List\u003e` - The modified image with the background color applied. |\n\n\n## ⛔️ iOS Issue\n\u003cdetails\u003e\n  \u003csummary\u003eException: ONNX session not initialized (iOS Release Mode \u0026 TestFlight)\u003c/summary\u003e\n  \u003cbr\u003e\n\n  To resolve this issue, update the following settings in Xcode:\u003cbr\u003e\n\n  Open Xcode and navigate to:\u003cbr\u003e\n  Runner.xcodeproj → Targets → Runner → Build Settings\u003cbr\u003e\u003cbr\u003e\n\n  Under the Deployment section:\u003cbr\u003e\n  Set \"Strip Linked Product\" to \"No\"\u003cbr\u003e\n  Set \"Strip Style\" to \"Non-Global-Symbols\"\u003cbr\u003e\n\n\u003c/details\u003e\n\n\n## ⚠️ Warning\n\nThis package uses an offline model to process images, which is bundled with the application. **This may increase the size of your app**. \n\n\n## 🔗 Contributing\nContributions are welcome! If you encounter any issues or have suggestions for improvements, feel free to create an issue or submit a pull request.\n\n## ☕ Support This Project\nIf you find this package helpful and want to support its development, you can buy me a coffee! Your support helps maintain and improve this package. 😊\n\n[![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-donate-orange?style=flat-square\u0026logo=buy-me-a-coffee)](https://www.buymeacoffee.com/neteshpaudel)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetesh5%2Fimage_background_remover","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetesh5%2Fimage_background_remover","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetesh5%2Fimage_background_remover/lists"}