![]() | ![]() |
This tutorial will be discussing depth of field and how to create this effect in the Gimp.
I recently had a request for doing a tutorial on how to make the background blurry so that the focus is on the subject. In photography this is know as Depth of Field (DOF).
Depth of Field Explained:
From Wikipedia: "In optics, particularly as it relates to film and photography, depth of field (DOF) is the distance between the nearest and farthest objects in a scene that appear acceptably sharp in an image. Although a lens can precisely focus at only one distance at a time, the decrease in sharpness is gradual on each side of the focused distance, so that within the DOF, the unsharpness is imperceptible under normal viewing conditions."
To explain depth of field, I will use two types of photography for examples. Landscape photography and portrait photography. When taking a landscape photograph, you typically want everything to be in focus. To to this you will want a large depth of field. In portrait photography, you want to focus on the subject and have the background be blurry to not distract from your area of focus. For this you will need a shallow depth of field.
On a camera, increasing the f-number (decreasing the aperture diameter) increases the DOF; decreasing f-number decreases DOF.
Tweaking the aperture is something most people don't know how to do (some cameras it is not even possible). One thing you can do for this is stand back and zoom in; OR you can use the Gimp!
I am going to do two examples for this tutorial. The first is going to be very basic, then I will do a more advanced tutorial.
Beginning Tutorial
Find the image you want to use. The image below is a picture of some wild daisies in Alaska. I wanted to focus on just one, but I had my camera mode on automatic and the background daisies should look like they are more in the background.
I always make one or two copies of my original file. For this you will at least need to make one copy. Just press the copy layer icon in the layers window.
Once you have the subject selected, I like to go to the paths tab (layers window) and select the selection to path tool. It is always a good idea to save your selection in case you need it again (we won't be doing that on this tutorial, but we will on the next. And it is a good habit to get into).
On the top layer, right click and select Color To Alpha. This will let us delete the background.
Invert the selection so that we can delete everything BUT the flower. Press the delete key.
Now that we have deleted the background, press the eye icon on that layer so we can no longer see it, then select the lower layer (the layer with nothing deleted) and invert the selection again so that the flower is selected.
Grow the selection by about 15 pixels (Select>Grow)
Use Resynthesize to get rid of the flower. If you have not used resynthesize before (or don't have it installed) please check out my tutorial on that plugin.
Resynthesize should do a pretty good job at removing your subject. It does not matter if it completely removes it, we are only concerned with the area right by the selection.
Now go to Filters>Gaussian Blur and blur the background. Play with the blur till you are satisfied. Because my background was not very blurry to begin with, I used 100-200 for the Gaussian blur.
It should look like this.
Now press the eye on your top layer to get the flower to show up again.
That is it. If you want, you can do more tweaks and level adjustments. This works out well because you can adjust each layer separately.
![]() |
| Final image with darkened background |
|
|
This is probably fine for most of your images, but suppose you have an image with layers of objects, or the ground/floor is in the image. You will need to do some more advanced tweaking.
Advanced Tutorial:
Recently I went to Color Me Mine to paint a mug.
In the image below, notice the following:
- The Tutorial Geek mug is in the foreground. We want this to be the subject in focus.
- There shelves are in the background. We want this to be blurrier to bring more attention to the subject.
- There is a mug in the middle (midground?) We want this to be blurry, but not as blurry as the background since it is not back that far. This will need to be isolated.
- The table is also in the picture. The part of the table closest to us needs to be in focus because it is in the background and the part of the table farthest from us needs to be blurry because it is in the background. This will require a gradient blur.
Make a bunch of background copies. We will need at least four.
Select each mug, then in your paths dialog, save the selection to path so we can use these selections later.
With both mugs selected (on the top layer) run the resynthesize plugin. This took forever. Read a good news article while you wait.
You will notice that resynthesize was not able to completely get rid of the mugs. This is fine.
Move this layer almost to the bottom. We still need at least one original copy of the image below this. Go to the different layers to delete the background from the mugs (remember how we saved the selection to path? We did this so now we could go path to selection). Remember to change layers to Color To Alpha and invert the selection before deleting.
You should end up with the foreground mug, midground mug and background with no mugs. (See screenshot below)
First, we will want to select the Background Only layer and do a Gaussian blur.
Looks pretty goofy. We need to blur the midground mug. Blur about half the amount you did for the background.
Looks better, but the table makes it look goofy.
Right click the background only layer and add a layer mask.
Go ahead and use default settings (white)
Press the blend tool. The default gradient should work fine.
Start the gradient at the back of the table and move to the front.
Now it looks a bit more normal.
If you want to get a bit more advanced, you can copy the foreground mug and do a mask for that as well to blur some of the curvature.
That is it! You can adjust the levels in the different layers to get the look you want.
![]() |
| Before |
![]() |
| After |
|
|

































18 comments:
Brilliant tutorial, stumbled ;)... Keep up the good work :)
Thanks for the stumble!
Thanks McKay for honoring my request. Much appreciated. Had checked couple of tutorials out there but wasn't satisfied. After doing this, the result is awesome, just as I wanted! Cheers..
You are very welcome Emmanual! Thanks for the great suggestion. Glad my tutorial worked out for you.
Thanks for the tutorial, still learning about GIMP!
This is an excellent tutorial...thanks!!
Excellent tutorial! Thanks.
Thanks for the info!
I have the final result of a tutorial I did back in Dec. 2009. For the life of me, I can't find the actual tutorial. I've uploaded the result (http://www.box.net/shared/j6izu7bt825d406bqkcl). Do you know where I may find the original tutorial?
dang, I've seen several tutorials on this topic, and most of them are half-baked: just select the flower/mug, and blur the inverted selection.
you went the extra mile with resynthesize and gradient blur, the two most important steps.
as I read the article from top to bottom, surprise after surprise :-)
thanks much
Really nice !
-Technologov
Thanks for your nice comments! I greatly appreciate your kind words.
Hi, I'm very interested in this topic, but the images are not shown (Error 403, Forbidden). Could you please try and fix it?
Thanks,
Images not shown...
hey excellent tutorial. I have just started learning about Gimp and reading up Gimp tutorials from anywhere I can find. But this one was awesome. Never tried resynthesize before. I'll try today and let you know the result.
Abhishek
This is indeed brilliant tutorial that I ever read. It is great to know something informative about the Gimp. I am planning to create business card for my company using the same thing.
Excellent tutorial. I tried this one and the tut. on 3d effect. Both were very clear, I learned a lot and I was pleased with my first attempts. Thanx.
It had great tutorials at the same time opportunity for us to ask questions. Each type of model requires different type of skills and efforts so a person must know that what he wants to use. Well thanks so much for your thoughts and efforts that you put in your post for making it easier to understand for everyone.
Post a Comment
Copy this HTML tag to allow you to leave a link in your comment:
<a href="http://link url">link text</a>