Free plan

Blur background

Keep the subject sharp and blur everything behind it
POST
/v1/images/blur-background
Background blurred
Original
OriginalBackground blurred

About this tool

Keeps the main part of a picture sharp and blurs the rest, like portrait mode on a phone. By default it finds the subject when the background is fairly plain. Otherwise you can set a sharp area yourself (an oval, a rectangle or a band). You choose how strong the blur is and how soft the edge looks. It works best on simple backgrounds.
For example, you make a person stand out in a busy street photo by blurring the street.

How to use it

  1. Choose this tool.
  2. Add your picture with Upload or drag and drop.
  3. Choose how to find the sharp area and how strong the blur should be.
  4. Press Generate.
  5. Download the result.

What you get back

You get a new picture with a sharp subject and a blurred background that you can download.
GOOD TO KNOW
auto only works on pictures with a plain background; otherwise (or when no subject is found) it answers 400 and you set focus to a shape. No face or object is recognised. Counts as one image per picture.
TEST IT LIVE

Try Blur background in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Images
Plan
Free
Method
POST
Endpoint
/v1/images/blur-background
Tool ID
images.blur-background
Authentication
API key
Accepts
JPEG, PNG, WEBP, GIF, AVIF, TIFF +15 more
Background jobs
Yes
Usage group
Image
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/images/blur-background" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'images=@photo.jpg' \
  -F 'focus=auto' \
  -F 'strength=12' \
  -F 'center_x=50'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.images.blurBackground({
    "images": 'photo.jpg',
    "focus": "auto",
    "strength": 12,
    "center_x": 50
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->images()->blurBackground([
    'images' => 'photo.jpg',
    'focus' => 'auto',
    'strength' => 12,
    'center_x' => 50,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Keep the subject of a picture sharp and blur the rest, like a portrait-mode photo: the subject is found by cutting away the plain background, or you give the shape of the sharp area (ellipse, rectangle, or a band for a tilt-shift look). Set the blur, the softness of the edge, a dimmed or grey background and a vignette.

Blur background accepts JPEG, PNG, WEBP, GIF, AVIF, TIFF, SVG, SVGZ, BMP, ICO, APNG, PNM and 9 more. You can send several files in one request.

Blur background is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/images/blur-background with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.