Blog
  • Login

  • Login
  • Register
  • Blog

  • Articles
  • fr
  • de

πŸ–ΌοΈ Automatically remove the background from your images with Claude and RMBG

on August 24, 2025

Removing an image's background is a common task in design, e-commerce, and content creation. Many tools exist, some paid, others free... but when you want to automate the process, it can quickly become complicated.

In this article, I show you how to use Claude Code to assist you in installing and configuring RMBG (Remove Background), an open-source tool that automatically removes image backgrounds.

πŸ‘‰ The full source code is available here: πŸ”— GitHub – matyo91/remove-background

🌐 The various existing solutions

Before getting into the heart of the matter, here's a quick overview of the available solutions:

  • Remove.bg: simple, effective, but paid (credit system + API).
  • Adobe Photoshop: powerful, but requires a subscription.
  • Canva: offers a Background Remover, but reserved for the Pro version.
  • GIMP: free and open-source, but removal remains manual (selection by color, tolerance, etc.).
  • RMBG: open-source, free, works from the command line or via a Python script β†’ ideal for automation.

βš™οΈ Install Claude Code and start a project

Claude Code (by Anthropic) is a tool that assists developers directly in their terminal. It allows you to:

  • install dependencies,
  • fix common errors,
  • speed up the setup of complex environments.

Quick Installation

npm install -g @anthropic-ai/claude-code

Then, run:

claude

Claude will guide you step by step (authentication, configuration, etc.).

πŸ‘‰ Complete documentation: Claude Code – Anthropic

πŸ–ΌοΈ First attempt with GIMP

With GIMP, it's possible to remove the background using the Select by Color Tool (Shift+O). But the process is entirely manual: click on the background, adjust the tolerance, start again...

πŸ‘‰ Result: Useful for some images, but not suitable for automation.

πŸ”§ Installing and using RMBG

RMBG is easily installed with Python:

pip3 install rembg

If any dependencies are missing (Onnx Runtime, aiohttp, etc.), Claude Code automatically detects them and offers to fix them with one click.

Then, the basic command is simple:

rembg i input.png output.png

πŸ‘‰ This command takes input.png and generates output.png without the background.

🐍 Automate with a Python script

To go further, we can automate the processing of an entire folder of images.

Example Python script (present in the GitHub repo):

from rembg import remove
import bone

input_folder = "images"
output_folder = "imagesRemoveBackground"

os.makedirs(output_folder, exist_ok=True)

for file_name in os.listdir(input_folder): 
if file_name.lower().endswith((".png", ".jpg", ".jpeg")): 
input_path = os.path.join(input_folder, file_name) 
output_path = os.path.join(output_folder, file_name) 

with open(input_path, "rb") as inp, open(output_path, "wb") as out:
out.write(remove(inp.read()))

πŸ“‚ Place your images in images/, run the script, and all your photos will be generated without background in imagesRemoveBackground/.

πŸ“š Documentation and available templates

RMBG can be used in several ways:

  • As a Python library,
  • As an HTTP Server,
  • Via Docker.

It also supports different templates (UΒ²Net, etc.), adapted to the type of image to be processed (e-commerce products, portraits, various objects).

πŸ‘‰ Official documentation: RMBG GitHub

βœ… Conclusion

In this article, we have seen several solutions for removing the background from an image.

  • Paid tools (Remove.bg, Photoshop, Canva) work well but are expensive.
  • GIMP remains a good manual option, but has limitations.
  • The Claude Code + RMBG combination is the most effective way to automate the process easily and for free.

πŸš€ Try it now by cloning the repo: πŸ”— matyo91/remove-background

πŸ‘‰ If you liked this tutorial, please share it, leave a comment, and try RMBG for your own projects!

🎁 I offer free 30-minute coaching sessions to help creators like you automate their processes and save time ⏱️

πŸ‘‰ Book your free session here: https://www.bonzai.pro/matyo91/lp/4471/je-taide-a-automatiser-tes-process

Thank you for reading! Let's create smart, fast, and automated workflows together πŸ’»βš‘

  • Sitemap - Hello - Blog - Apps - Photos - Contact - - - - - Legal mentions - Darkwood 2025, all rights reserved