From f69a5892ccc3245296f3897819d5cc4955598b09 Mon Sep 17 00:00:00 2001 From: kev Date: Fri, 8 Mar 2024 17:26:37 +0800 Subject: [PATCH] add rembg --- README.md | 1 + rembg/README.md | 32 ++++++++++++++++++++++++++++++++ rembg/docker-compose.yml | 8 ++++++++ 3 files changed, 41 insertions(+) create mode 100644 rembg/README.md create mode 100644 rembg/docker-compose.yml diff --git a/README.md b/README.md index 1b23dad..7640cdd 100644 --- a/README.md +++ b/README.md @@ -455,6 +455,7 @@ A collection of delicious docker recipes. - [x] prosody/prosody - [x] redis/redis-stack - [x] registry +- [x] danielgatis/rembg - [x] datarhei/restreamer - [x] restic/rest-server - [x] rocker/rstudio diff --git a/rembg/README.md b/rembg/README.md new file mode 100644 index 0000000..b99ae94 --- /dev/null +++ b/rembg/README.md @@ -0,0 +1,32 @@ +rembg +===== + +[Rembg][1] is a tool to remove images background. + +## Web Service + +```bash +$ docker compose up -d +$ url=https://raw.githubusercontent.com/danielgatis/rembg/master/examples/girl-3.jpg +$ curl -sSL $url -o input.jpg +$ curl -s -G http://localhost:7000/api/remove -d url=$url -o output.png +$ curl -s http://localhost:7000/api/remove -F file=@input.jpg -o output.png +``` + +## Ad Hoc Commands + +```bash +# Create an alias +$ alias rembg='docker run --rm -u $(id -u):$(id -g) -v $PWD:/rembg danielgatis/rembg:2' + +# Remove the background from a local file +$ rembg i input.png output.png + +# Remove the background returning only the mask +$ rembg i -om input.png output.png + +# Remove the background applying an alpha matting +$ rembg i -a input.png output.png +``` + +[1]: https://github.com/danielgatis/rembg diff --git a/rembg/docker-compose.yml b/rembg/docker-compose.yml new file mode 100644 index 0000000..9b709c2 --- /dev/null +++ b/rembg/docker-compose.yml @@ -0,0 +1,8 @@ +version: "3.8" +services: + rembg: + image: danielgatis/rembg:2 + command: s --host 0.0.0.0 --port 7000 --log_level info + ports: + - "7000:7000" + restart: unless-stopped