Background Blur
Overview
The Image Editing API allows you to easily blur the background of any image.
To blur the background of an image, set the argument background.blur.mode to either the value:
bokehA bokeh blur simulates the out-of-focus effect of a camera lens. Highlights and bright areas form soft, circular shapes, creating a natural depth-of-field look with smooth, cinematic background blur.gaussianA gaussian blur applies a soft, even blur by averaging each pixel with its neighbors using a bell-curve weighting. This creates a smooth, natural blur that reduces fine detail and noise
(original image)
background.blur.mode=bokeh
background.blur.mode=gaussian



In order to blur the background, you need to also set removeBackground to false
If you want to give it a try, here's the code to reproduce the example above:
curl --request POST \
--url https://image-api.photoroom.com/v2/edit \
--header 'x-api-key: YOUR_API_KEY_HERE' \
--form imageFile=@/path/to/image.png \
--form background.blur.mode=bokeh \
--form removeBackground=falseAdditional parameters
background.blur.radius
background.blur.radiusTo the control the strength of the blur, set the argument background.blur.radius to a value strictly greater than 0 and lower than or equal to 0.05.
Higher values mean the result will be blurrier.
This argument is optional and has a default value of 0.01.
Last updated
Was this helpful?