As I mentioned in a previous post, I’ve been working on Ubuntu lately. It’s kind of funny, I’m using what I call a MacBuntu. We had this 2012 MacBook Air at home (we’re in 2025 as I write this), and it was so old that Apple no longer allowed OS updates. So I ended up formatting it, installing Ubuntu, and here I am, posting from it.
It had been a while since I’d used any Linux distro. I normally work on macOS and didn’t really have a need to switch. Not long ago, I was working on a blog post and wanted to add some images to it. I needed to blur out certain areas of the image to hide some information.
I found that Ubuntu doesn’t come with a pre-installed graphical application to do this. A quick search online told me I could achieve it with ImageMagick from the terminal.
The command is:
convert input.jpg -region WxH+X+Y -blur RadiusxSigma +region output.jpg
Where:
convert is the command to use ImageMagick.
input.jpg is the image we want to edit, either with the full path, or just the filename if we’re already in the directory.
With -region we specify the area we want to blur, and we need to pass a string composed of several parameters:
W is the width of the area to blur.
H is the height of that same area.
X is the horizontal coordinate of the top-left corner.
Y is the vertical coordinate of that same corner.
So, for example, if we write 100x50+200+30, we’re telling it to apply a box that is 100 px wide by 50 px tall, with its top-left corner at point (200,30).
Next is the command to apply the blur. -blur takes two values: radius and sigma. The documentation says:
“The radius is only used to determine the size of the matrix that contains the calculated Gaussian distribution. It must be an integer. If not provided or set to zero, IM will calculate the largest possible radius that still produces meaningful results for the Gaussian distribution.”
And about sigma:
“The sigma value is the important argument and determines the actual amount of blur that will be applied.”
So really, you need to provide two numbers, where the second, sigma, is the important one, as it controls how blurred you want the result. In my case, I used 0x5 and it worked fine. You can experiment with different values. Finally, the +region command, from what I read, ensures that only the selected box is blurred, and the rest of the image remains unchanged.
Lastly, you write the name of the file, with full path if needed, where you want the new image to be created. If you want to overwrite the original image, with the blurred version, you can use the same filename, for both input and output, and it will replace the original (I don’t recommend this, because if you make a mistake, your original image is gone and there’s no way to get it back).
So, how do we get those values? I opened my image using ImageMagick’s graphical interface… Wait, didn’t I say it doesn’t have one? Well, yes and no. To do this, go to where your file is (using Nautilus or whatever file browser you use), right-click the image you want to work on, and from the menu select Open with, then look for ImageMagick in the dialog.

Once that’s done, your image will open, and then you follow these steps:
- Click on the image to show the menu.
- Click on Image Edit…
- Click on Draw…
This will open a small box in the top-left corner of the image that shows the pointer coordinates.
Now we want to determine the two diagonally opposite corners of the box we want to blur. Why? So we can calculate the width and height. Let’s use the image above to do that, we’re going to blur the third message.


In our example, the corners are (92,183) and (394,211), so we do a bit of math:
width = 394-92
height = 211 - 183
Now we have all the information we need to build our command. Head to the terminal and type:
convert image.jpg -region 302x28+92+183 -blur 0x5 +region image.jpg
I had to pull out the calculator, subtract the values, and edit the command, but it works. Let’s give it a try.
Alright. Now let’s take it up a notch. Back in a previous post when I first started looking into this, I had to blur three different areas on the same image. So it started to get a bit tedious: finding the coordinates, calculating the dimensions, remembering the command syntax, which options to use, and what values go where.
So what I did was create a small function in Bash, which takes 4 pieces of data:
- The name of the image you want to modify.
- The name of the output image (you can use the same name to overwrite).
- Coordinates of the top-left corner of the blur area.
- Coordinates of the bottom-right corner of the blur area.
Here’s the function:
# Function for blurring images on specific regions
blur_images_region () {
read -p "Input file path and name: " input_file
read -p "Output file path and name: " output_file
echo "Let get coordinates for the top-left corner"
read -p "X point: " x_top_left
read -p "Y point: " y_top_left
echo "Now let's get the coordinates for the bottom-right corner"
read -p "X point: " x_bottom_right
read -p "Y point: " y_bottom_right
width=$((x_bottom_right-x_top_left))
height=$((y_bottom_right-y_top_left))
region_string="${width}x${height}+${x_top_left}+${y_top_left}"
convert ${input_file} -region ${region_string} -blur 0x5 +region ${output_file}
}
What does it do?
- It gathers all the necessary values.
- It calculates the width and height of the blur area.
- It builds the string for the -region option.
- And it runs the command using a 0x5 blur.
As a little assignment, try adding more input reads for the two blur values so you can experiment with the effect’s appearance.
And that’s it, happy blurring on Ubuntu!