Drive Background Remover (Local Edition)

Engineering a Local Background Removal Workflow with Python & n8n

Removing image backgrounds is a common but repetitive task, especially in creative, ecommerce, or production workflows. While services like remove.bg offer high-quality results through cloud APIs, they come with limitations: rate limits, recurring costs, and external data processing. This project explores an alternative: a fully local, automated background removal pipeline built using Python and n8n.

System Overview

The goal was to build a modular and private system that could:

  • Detect new image uploads in a connected cloud folder (Google Drive)

  • Remove the background locally using a lightweight AI model

  • Return the processed image without manual effort

The core flow is simple:

  • A file is added to a designated Google Drive folder

  • An n8n workflow is triggered to download the image into a local directory

  • A Python script, continuously monitoring this folder, processes the image using rembg

  • The cleaned result is saved into another local directory

  • Finally, n8n picks up the processed image and re-uploads it to a separate Drive location

This creates a seamless loop: upload → clean → deliver — all without cloud APIs or human interaction.

Technical Components

The system combines several technologies:

  • n8n: for orchestration and API interactions (Google Drive, file handling)

  • Python: for the core image processing logic

  • rembg: an open-source tool for AI-based background removal

  • watchdog: a lightweight Python library to detect filesystem changes

  • Docker: to host the workflow and isolate the environment

Folder monitoring and file transfers are handled locally. The architecture is designed to be container-compatible and cross-platform. All moving parts are replaceable or extensible — for example, rembg can be swapped for a different model, and the flow can include compression, watermarking, or notifications.

Design Considerations

A previous version of this project used the remove.bg API. While the visual output was excellent, the setup depended heavily on the cloud — which introduced privacy concerns, pricing tiers, and a lack of extensibility. This local-first design sacrifices a small amount of cutout quality for long-term flexibility, lower cost, and full ownership.

The structure avoids hardcoded file paths and supports reconfiguration. Input and output directories are mounted via Docker volumes, allowing integration with various environments (local machine, NAS, VPS).

Why It Works

This project demonstrates the power of modular, automation-friendly architectures:

  • The file watcher and processor are decoupled from the cloud logic

  • Each step can be independently developed or replaced

  • The same setup could serve different users or teams with minor adjustments

  • Deployment scales from personal use to production scenarios

It’s a small example of building infrastructure that saves time, reduces reliance on external services, and adapts to real-world constraints.

This isn’t just a script — it’s a composable system.
For more technical experiments and structured automation work, visit:
beyzabetulcelik.com

Next
Next

Prompt Refiner: Building an AI Tool That Lives on My Laptop