Fake Depth of Field in Gimp - DOF Explained

Before Fake DOF
After Fake DOF
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.

 Now we want to use the Free Select Tool. Select the subject in the photo.

Select Feather Edges to give it a nice transition when we are done.

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 "Add Alpha Channel." 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.






  1. Brilliant tutorial, stumbled ;)... Keep up the good work :)

  2. 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..

  3. You are very welcome Emmanual! Thanks for the great suggestion. Glad my tutorial worked out for you.

  4. Thanks for the tutorial, still learning about GIMP!

  5. This is an excellent tutorial...thanks!!

  6. Excellent tutorial! Thanks.

  7. 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?

  8. 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

  9. Really nice !


  10. This comment has been removed by the author.

  11. Thanks for your nice comments! I greatly appreciate your kind words.

  12. Hi, I'm very interested in this topic, but the images are not shown (Error 403, Forbidden). Could you please try and fix it?

  13. Images not shown...

  14. 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.

  15. 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.

  16. 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.

  17. 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.

  18. I think this post is greater post then another because its short but effective and impressive content which give the best knowledge.

  19. I am interested in this topic and would like to find out some more information as my friend need information on this topic.

  20. I always find such amazing posts on this website and today’s post was really amazing. Now I have become a regular user of this website. Thanks for giving us so much knowledge.

  21. I have struggled with whether to buy a bigger lens after always wanting images with crisp foreground and blurred background. Thanks to this tut and gimp we are there!
    Thanks for sharing your tips!

  22. I have found this article very exciting. Do you have any others on this topic? I am also sending it to my friend to enjoy your writing style. Thanks!

  23. It is the great tutorial and nice things to learn, its very attractive way to learning any things.
    Thanks for sharing this great info.

  24. Nice article you are shared among us this is pretty much way to learning these things.

  25. I saw a post on this site and have posted many articles, I and some of them, detailed information about this topic in your next article here to take more interest would be appreciated !

  26. I look forward in reading more of your work. Also, I made sure to bookmark your website so I can come back later. I enjoyed every moment of reading it.

  27. Thanks for this!!! LOVE IT, gonna try it later on. :) <3

  28. Really Fantastic article, well written and extremely useful, thanks. This information is great to me.
    rubber materials

  29. Excellent, exhaustive and advanced tutorial. Thanks. :)

  30. Awesome tutorial, I really like the clarity of the steps and examples. Great job!

  31. Great tutorial. What's the difference between doing resynthesize and not doing resynthesize? The focus layer will cover up that portion anyway.

  32. If you don't do resynthesize, then it would blur part of your subject into the area of the picture. For example, if I did not remove the white flower, then the area immediately surrounding the flower would have a white blur.

  33. Hi there! Were you somehow able to fulfill all the options of this blog all by yourself or you got professional help?

  34. I maintain the blog myself. All tutorials are ones I have written.

  35. Hey buddy..i am working on my website products...thsi fujifilm s2980 seems nice Camera..i am basically working on Leather products..do you recommend this to me...

  36. PnS camera..couldnot handle DOF so ..i think this is the only option for my product shoot....thanks

  37. PnS camera..couldnot handle DOF so ..i think this is the only option for my product shoot....thanks

  38. I must say that this tutorial lacks some extra info (Where do I find Color to Alpha, etc.) that you have figure out because the author takes it for granted that you are a pro. And if you are a pro why would you read this tutorial?

    1. Thanks for catching my mistake. I should not have written "Color to Alpha." It should in fact say "Add Alpha Channel." I have updated the blog to change this.

      If you can find any other mistake, please let me know.


  39. hello sir

    Nike Mission: To bring inspiration and innovation to every athlete in the word, if you have a body you are an athlete. Das Leben ist ein Sport: Nike hat sich als Ziel gesetzt, mit innovativen produkten Athleten zu besserer Leistung zu verhelfen und jeden zu mehr Sport zu motivieren. Nike ist aber auch die Marke für einen sportlichen Lebensstil neben dem Sportplatz. Mit sportlichen Designs brillieren auch die Freitzeitmodelle in jeder Hinsicht. Coole Farbkombinationen und ein dynamisches Design motivieren im Sport die volle Leistung zu

    Nike Schuhe.

    Thank you!!! This is good!


Copy this HTML tag to allow you to leave a link in your comment:
<a href="http://link url">link text</a>