Skip to main content

Python SDK for the BGBlur API.

Project description

bgblur-ai

Official Python SDK and CLI for BGBlur.com, an AI visual privacy platform for blurring and anonymizing faces, license plates, and custom objects in images and videos.

bgblur-ai is the Python SDK for BGBlur.com. Use it to add automated privacy protection, visual redaction, and dataset anonymization workflows to Python scripts, backend jobs, and command-line pipelines.

BGBlur.com helps creators, developers, businesses, and AI teams protect visual privacy in photos and videos. It is built for workflows where faces, license plates, people, vehicles, backgrounds, or sensitive objects need to be blurred before sharing, publishing, reviewing, or using media in datasets.

What You Can Do

  • Blur faces in images and videos for privacy protection.
  • Anonymize faces in videos for identity protection.
  • Blur license plates in vehicle images, dashcam footage, CCTV, and street scenes.
  • Blur custom objects with a text prompt using BGBlur's blur-anything workflow.
  • Prepare privacy-safe datasets for AI training, computer vision, and content review.
  • Automate video redaction and image redaction from Python or the bgblur-ai CLI.

Why BGBlur.com

BGBlur.com focuses on practical visual privacy automation. Manual video redaction and image editing can be slow, repetitive, and hard to scale. BGBlur helps teams process privacy-sensitive media faster by combining AI face blur, license plate blur, prompt-based object blur, and video anonymization in one platform.

Common use cases include:

  • Privacy-safe social media publishing.
  • CCTV, dashcam, bodycam, and street footage redaction.
  • AI dataset anonymization before model training.
  • Customer support, legal, security, and compliance media review.
  • Creator, journalist, researcher, and business privacy workflows.

Installation

pip install bgblur-ai

The PyPI package name is bgblur-ai. The Python import name is bgblur_ai.

Authentication

Create an API key from your BGBlur developer dashboard:

https://www.bgblur.com/developers/api-keys

Set it as an environment variable:

export BGBLUR_AI_API_KEY="YOUR_API_KEY"

Or pass it directly when creating a client.

Quick Start

from bgblur_ai import PrivacyBlur

with PrivacyBlur(api_key="YOUR_API_KEY") as client:
    client.face_blur(
        input="image.jpg",
        output="result.jpg",
        blur_type="gaussian",
    )

Python Examples

Blur faces:

from bgblur_ai import PrivacyBlur

with PrivacyBlur(api_key="YOUR_API_KEY") as client:
    client.face_blur(
        input="image.jpg",
        output="face-blurred.jpg",
        blur_type="gaussian",
    )

Blur license plates:

from bgblur_ai import PrivacyBlur

with PrivacyBlur(api_key="YOUR_API_KEY") as client:
    client.license_plate_blur(
        input="car.jpg",
        output="plates-blurred.jpg",
    )

Blur anything with a prompt:

from bgblur_ai import PrivacyBlur

with PrivacyBlur(api_key="YOUR_API_KEY") as client:
    client.blur_anything(
        input="street.jpg",
        prompt="person",
        output="objects-blurred.jpg",
    )

Anonymize faces in video:

from bgblur_ai import PrivacyBlur

with PrivacyBlur(api_key="YOUR_API_KEY") as client:
    client.face_anonymize(
        input="interview.mp4",
        output="anonymous-video.mp4",
    )

Dataset Processing

DatasetProcessor helps prepare privacy-safe image datasets by applying BGBlur operations across a folder.

from bgblur_ai import DatasetProcessor

processor = DatasetProcessor(api_key="YOUR_API_KEY")

report = processor.process_dataset(
    dataset_path="dataset",
    output_path="dataset_private",
    face_blur=True,
    plate_blur=True,
    blur_type="pixelated",
)

print(report.to_json())

CLI Usage

You can also run BGBlur from the command line.

bgblur-ai face-blur input.jpg output.jpg --blur-type gaussian
bgblur-ai face-anonymize input.mp4 output.mp4
bgblur-ai license-plate-blur car.jpg result.jpg
bgblur-ai blur-anything image.jpg result.jpg --prompt "person"
bgblur-ai dataset-process --input dataset --output dataset_private --face-blur --plate-blur --blur-type pixelated

API key resolution order:

  1. --api-key
  2. BGBLUR_AI_API_KEY

Base URL resolution order:

  1. --base-url
  2. BGBLUR_AI_BASE_URL
  3. https://www.bgblur.com

Errors

The SDK raises typed exceptions that can be caught in your application:

  • PrivacyBlurError
  • AuthenticationError
  • InsufficientCreditsError
  • RateLimitError
  • ServerError

Example:

from bgblur_ai import InsufficientCreditsError, PrivacyBlur, PrivacyBlurError

try:
    with PrivacyBlur(api_key="YOUR_API_KEY") as client:
        client.face_blur(input="image.jpg", output="result.jpg")
except InsufficientCreditsError as exc:
    print(exc)
except PrivacyBlurError as exc:
    print(f"BGBlur error: {exc}")

Keywords

AI face blur, video anonymization, license plate blur, image redaction, video redaction, privacy SDK, Python SDK, dataset anonymization, blur anything, object blur, visual privacy automation.

Development

python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bgblur_ai-0.1.1.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bgblur_ai-0.1.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file bgblur_ai-0.1.1.tar.gz.

File metadata

  • Download URL: bgblur_ai-0.1.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for bgblur_ai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9015d789fef8853c6e3cae2a2004fef080f50fa1d11cfcfca584a9c5f14fd284
MD5 7426c88f12ac6f7c80b5938e0ddcccd9
BLAKE2b-256 3ea6c6fb21fd8bce78f9844c6d5ab257f3ec7ed13fdbace7ed7146db2478792f

See more details on using hashes here.

File details

Details for the file bgblur_ai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bgblur_ai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for bgblur_ai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b17f077bdbd3b4c2b2c8d9e898bd39f6e1665bff9b57379a3e36b1a3e7f9b584
MD5 393fddd8da7054cb38e7d7deec2cb8b1
BLAKE2b-256 e8f68fb131c006e3a11e6cef237cce18f28b449219a8d269e3974589c2984f4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page