Skip to main content

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.

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}")

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.

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

Release files for bgblur-ai 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bgblur-ai 0.1.2
File Size Uploaded
bgblur_ai-0.1.2.tar.gz 16.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bgblur-ai 0.1.2
File Interpreter ABI Platform
bgblur_ai-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 34.0 kB

Release files / bgblur_ai-0.1.2.tar.gz

Download URL bgblur_ai-0.1.2.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
03dd86aa67e494cfb3efe55dcf7d55a795736cee02fbeeda2ef88b78d9f029a3
BLAKE2b-256 checksum
How to use checksums
e0c0e422c293c438ea60efa0de918211ae96ec001b51ac9d3bf6d6b4ed5c0001
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / bgblur_ai-0.1.2-py3-none-any.whl

Download URL bgblur_ai-0.1.2-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2b920828fdf2e52247e7fb628768113ce9058c6d900c15b87a3cd5eefbec94f
BLAKE2b-256 checksum
How to use checksums
a54faf5ad7534cdeb186650e96dd8ff89aef02be5b78c29285b5f237ede57a8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page