CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-rembg

Remove image background using advanced AI models including U-Net, BiRefNet, and SAM with support for multiple input formats and GPU acceleration

84

0.94x
Overview
Eval results
Files

task.mdevals/scenario-2/

Image Background Remover CLI

Build a command-line tool that removes backgrounds from image files using automated processing.

Requirements

Create a Python script that:

  1. Accepts an input image path and output image path as command-line arguments
  2. Removes the background from the input image
  3. Saves the result to the output path
  4. Handles common error cases gracefully (missing files, invalid paths)

The script should be executable from the command line with this usage pattern:

python remove_bg.py input.jpg output.png

Test Cases

  • Given a valid input image file and output path, the script successfully removes the background and saves the result @test
  • Given a non-existent input file, the script exits with a non-zero exit code and displays an error message @test
  • Given an input image with a human subject, the background is cleanly removed while preserving the subject @test

Implementation

@generates

API

import sys

def main():
    """
    Main entry point for the background removal CLI tool.
    Processes command-line arguments and performs background removal.
    """
    pass

if __name__ == "__main__":
    main()

Dependencies { .dependencies }

rembg { .dependency }

Provides background removal capabilities for images.

Install with Tessl CLI

npx tessl i tessl/pypi-rembg

tile.json