pense-bête de bruno sanchiz

Accueil > programmes > Images, Sons, Vidéos > détourage, contour,

détourage, contour,

Publié le 19 septembre 2025, dernière mise-à-jour le 4 septembre 2025, > 0 visites, >> 165987 visites totales.

rembg

REMBG enlever le fond :
https://github.com/danielgatis/rembg
https://github.com/danielgatis/rembg/blob/main/README.md

python3 -m venv /tmp/py-gimp-mcp&& source /tmp/py-gimp-mcp/bin/activate
#pip install rembg
pip install "rembg[cpu,cli]"

utilisation
rembg i /tmp/GP010281.JPG /tmp/a.jpg
rembg i --help
rembg s --host 0.0.0.0 --port 7000 --log_level info

models :

ben_custom
birefnet-cod
birefnet-dis
birefnet-general
birefnet-general-lite
birefnet-hrsod
birefnet-massive
birefnet-portrait
bria-rmbg
dis_custom
isnet-anime
isnet-general-use
sam
silueta
u2net
u2net_cloth_seg
u2net_custom
u2net_human_seg
u2netp
for MODEL in ben_custom birefnet-cod birefnet-dis birefnet-general birefnet-general-lite birefnet-hrsod birefnet-massive birefnet-portrait bria-rmbg dis_custom isnet-anime isnet-general-use sam silueta u2net u2net_cloth_seg u2net_custom u2net_human_seg u2netp ; do 
echo =================="$MODEL" ;
rembg i FichierADetourer.JPG -m "$MODEL" "$MODEL".jpg ;
done;
#!/bin/bash
LOCK="/tmp/rembg_lock"
if [ -f "$LOCK" ];then exit; fi

touch "$LOCK"
python3 -m venv /tmp/py-gimp-mcp&& source /tmp/py-gimp-mcp/bin/activate
#pip install rembg
pip install "rembg[cpu,cli]"

DossierDesImagesADeetourer=~/"Bureau/ImagesADeetourer/"

find "$DossierDesImagesADeetourer" -maxdepth 1 -type f |while read IMAGE; do
	rep="$IMAGE"_detouree
	mkdir -p "$rep"
	for MODEL in ben_custom birefnet-cod birefnet-dis birefnet-general birefnet-general-lite birefnet-hrsod birefnet-massive birefnet-portrait bria-rmbg dis_custom isnet-anime isnet-general-use sam silueta u2net u2net_cloth_seg u2net_custom u2net_human_seg u2netp ; do 
		FichierDeSortie="$rep"/"$(basename "$IMAGE")"_"$MODEL".jpg
		if [ ! -f "$FichierDeSortie" ];then
			#echo =================="$MODEL" ;
			rembg i "$IMAGE" -m "$MODEL"  "$FichierDeSortie";
		fi;
	done;	
done;
rm "$LOCK"
#if [ "A""$(find "$DossierDesImagesADeetourer" -maxdepth 1 -type f|wc -l)" != "A0" ];then nemo "$DossierDesImagesADeetourer";fi

[bruno sanchiz]