How to blur parts of an image?

I have read in your documentation about the blur parameter that blurs the entire image. But in my case I just want to blur out parts of an image. Like just blur out the faces in the image. Is that possible with ImageKit?

There is no easy way to do this in ImageKit where you can specify that you want to just blur out the faces in the image. I have logged it as a feature request here - Allow blurring of specific parts of an image

How to blur if you know the coordinates

There is a rather hacky way to do it if you already know the coordinates and the size of the area to blur. Let’s look at the steps

  1. Here is the original image
https://ik.imagekit.io/ikmedia/docs_images/Community/car_amg.jpg

  1. Overlay it with a blurred image variant of the same image
https://ik.imagekit.io/ikmedia/docs_images/Community/car_amg.jpg?tr=l-image,i-docs_images@@Community@@car_amg.jpg,bl-20,l-end

  1. Now if you know the coordinates of where to blur, and the width and height of the area to blur, you can crop the overlaid blur image and position it correctly. In my case below I know that I want to blur out a portion of 1000x200 dimension, and it starts at x=1500,y=900 in the image.

Here w-1000,h-200,cm-extract helps extract the area to blur, x-1500,y-1900 indicates top-left coordinates of where to blur and lx-1500,ly-1900 indicate the position of where to overlay the blur (this is the same as the values used for top-left coordinates)

Below is the URL (intentionally broken into different lines to help understand the transform)

https://ik.imagekit.io/ikmedia/docs_images/Community/car_amg.jpg?
tr=l-image,i-docs_images@@Community@@car_amg.jpg,bl-20,
w-1000,h-220,cm-extract,
x-1500,y-1900,
lx-1500,ly-1900
,l-end

If you know where to blur, then this can definitely be used.

To prevent someone from removing this blur, use signed URLs
To increase the blur intensity, increase bl-20 to bl-50 or any other number.