{"id":43908834,"url":"https://github.com/sssxyd/removebg-by-ai","last_synced_at":"2026-02-06T20:08:41.354Z","repository":{"id":247921809,"uuid":"826022405","full_name":"sssxyd/removebg-by-ai","owner":"sssxyd","description":"AI抠图工具","archived":false,"fork":false,"pushed_at":"2025-05-09T05:30:19.000Z","size":115792,"stargazers_count":57,"open_issues_count":2,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-09T06:26:04.118Z","etag":null,"topics":["ai","remove-background","removebg"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sssxyd.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":"2024-07-09T01:00:59.000Z","updated_at":"2025-05-09T05:30:23.000Z","dependencies_parsed_at":"2025-05-09T06:33:27.814Z","dependency_job_id":null,"html_url":"https://github.com/sssxyd/removebg-by-ai","commit_stats":null,"previous_names":["sssxyd/removebg-by-ai"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sssxyd/removebg-by-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sssxyd%2Fremovebg-by-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sssxyd%2Fremovebg-by-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sssxyd%2Fremovebg-by-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sssxyd%2Fremovebg-by-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sssxyd","download_url":"https://codeload.github.com/sssxyd/removebg-by-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sssxyd%2Fremovebg-by-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29174522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T19:56:27.068Z","status":"ssl_error","status_checked_at":"2026-02-06T19:56:18.934Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ai","remove-background","removebg"],"created_at":"2026-02-06T20:08:40.552Z","updated_at":"2026-02-06T20:08:41.346Z","avatar_url":"https://github.com/sssxyd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 项目简介\n\nRemoveBG by AI 是一个利用AI模型对指定图片的指定矩形区域进行抠图，将该区域内的主要单一物体或人物扣取出来，去除背景的工具。该项目使用了 [RMBG-1.4 AI模型](https://huggingface.co/briaai/RMBG-1.4)。\n\n## 效果展示\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"example/1-上传图片.jpg\" alt=\"上传图片\" width=\"30%\"\u003e\n    \u003cimg src=\"example/2-鼠标框选.jpg\" alt=\"框选区域\" width=\"30%\"\u003e\n    \u003cimg src=\"example/3-抠图下载.jpg\" alt=\"抠图效果\" width=\"30%\"\u003e\n\u003c/p\u003e\n\n## 功能特性\n\n- 自动识别并抠取指定区域内的主要物体/人物\n- 去除背景，使物体/人物更加突出\n- 不依赖显卡，可在普通办公电脑上运行\n- 提供简单易用的API接口\n\n## 安装与使用\n\n### Windows用户\n\n- 下载打包好的程序\n  - [百度网盘](https://pan.baidu.com/s/1feyn1JCC5iy5gi23Jt4haQ) 提取码：1234\n  - [Google Drive](https://drive.google.com/file/d/1W6je8T4EFxXuEzbwxn7mcLu9JYQKoNmY/view?usp=sharing)\n- 解压文件。\n- 运行程序。\n- 访问：http://localhost\n\nWindows程序的端口号80，如需修改端，可编辑 `.env` 文件。\n\n### 源码编译\n\n1. 克隆此仓库：\n\n    ```sh\n    git clone https://github.com/sssxyd/removebg-by-ai.git\n    ```\n2. 下载模型，因本账号的LFS配额用完，可从[RMBG-1.4](https://huggingface.co/briaai/RMBG-1.4)，或 [百度网盘](https://pan.baidu.com/s/1pexxJ-ziUvZLLFv7a_zDcQ)提取码1234, 下载模型文件覆盖到model目录\n\n3. 安装运行：\n    \n    ```sh\n    # 确保python版本 \u003e= 3.10\n    cd removebg-by-ai\n    python -m venv venv\n    source venv/bin/activate  # Windows 用户使用 `venv\\Scripts\\activate`\n    pip install -r requirements.txt\n   \n   python start.py\n    ```\n    或者使用docker安装\n\n    ```sh\n   cd removebg-by-ai\n   docker build -t sssxyd/rmbgapi .\n   docker run -d -p 80:10086 sssxyd/rmbgapi\n   ```\n\n### Command Line:\n1. Compile from source code\n    ```sh\n    pyinstaller --onefile --name=removebg --icon=favicon.ico .\\command.py\n    ```\n    **Please ensure that the packaged executable file and the model directory are in the same directory.**\n\n\n2. Download Windows executable file  \n    - [Google Drive](https://drive.google.com/file/d/1lFvR74Br1EZP4zO9oWCekC6B3O6LEg2t/view?usp=sharing)\n\n\n3. Usage\n    ```\n    Usage: removebg SRC_IMAGE_PATH TARGET_IMAGE_PATH\n    or:    removebg SRC_IMAGE_URL TARGET_IMAGE_PATH\n    Options Supported:\n            --rect=rectangle      optional, selected rectangle: x,y,width,height   \n   ```\n## API接口\n\n### /removebg\n\n- **Method**: POST\n- **Content-Type**: application/json\n- **Parameters**:\n  - `path: str` - 图片的相对地址；path/url/base64三选一\n  - `url: str` - 图片的http地址；path/url/base64三选一\n  - `base64: str` - 图片的base64格式数据；path/url/base64三选一\n  - `selectPolygon: [[x1,y1], [x2, y2], [x3, y3], [x4, y4]]` - 可选，图片上的rectangle四个点的坐标\n  - `editorSize: [width, height]` - 可选，框选图片时，图片缩放图的宽度和高度\n  - `responseFormat: int = 0` - 返回的数据类型 0/1, 默认0\n- **Return**:\n  - responseFormat == 0: application/json {code:int, msg:string, result:base64Str}， code == 0 则成功，否则失败\n  - responseFormat == 1: image/png字节流\n \n### /removebg\n\n- **Method**: GET\n- **Parameters**:\n  - `url: str` - 图片的http地址\n- **Return**:\n  - 成功: image/png字节流\n  - 失败: application/json {code:int, msg:string} \n  \n## 使用示例\n\n```\nhttp://localhost/removebg?url=https://xxx.com/xx.jpg\n```\n\n```ts\n    const payload = {\n        base64: imageBase64,\n        selectPolygon: [[100,100], [200,100], [100, 200], [200,200]],\n        editorSize: [400, 300],\n        responseFormat: 0\n    }\n    fetch('/removebg', {\n        method: 'POST',\n        headers: {\n            'Content-Type': 'application/json'\n        },\n        body: JSON.stringify(payload)\n    })\n    .then(resp =\u003e {\n        if(resp.status == 200){\n            resp.json().then(apiResult =\u003e {\n                if(apiResult.code != 0){\n                    alert(apiResult.msg)\n                }\n                else{\n                    responseImageBase64 = apiResult.result\n                }\n            }).catch(error =\u003e {\n                console.log(error)\n            })\n        }\n        else{\n            console.error(resp.status + \":\" + resp.statusText)\n        }\n    })\n    .catch(error =\u003e {\n        console.log(error)\n    })\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsssxyd%2Fremovebg-by-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsssxyd%2Fremovebg-by-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsssxyd%2Fremovebg-by-ai/lists"}