How to ‘heal’ photos without the magic tool.

I have revised this technique. See the latest version here.

Healing - Before and After
Here is an alternative to using the healing brush in GIMP 2.3. I think it its good because:

  • It achieves good results
  • It will work in GIMP 2.2
  • Once you have set up the layers it is very quick to do
  • My old computer, a 1GHz Athlon, has no problems with showing the brush strokes in real time.
  • You have a lot more control

Read on to learn all about it.

For this demo I used a photo I found on flickr:

http://flickr.com/photos/gusdiaz/29802203/

It is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 2.0

Part 1 – The set up

If you can write scripts for the GIMP you can automate this process. I can’t write scripts, so if you do write one I’d love to get a copy.

1. Duplicate the layer twice

2. Name the top layer ’16th size’

3. Name the middle layer ‘quarter size’

4. Resize ’16th size’ layer to 6% original size with linear scaling

5. Resize ‘Quarter size’ layer to 25% original size with linear scaling

Scale the layer

6. Rescale both ’16th size’ and ‘quarter size’ layers back to the original image pixel dimensions using ‘Sinc’ interpolation (or Cubic if you are not using Gimp 2.2). Do not use percentages, use pixel values. Check that the both width and height values match your image size.

-At this stage you should have 3 layers of equal size, the original image, a somewhat blurry layer (called quarter size) and a very blurry layer (16th size)
Stage one layer set up

7. Hide the ’16th size’ and set the ‘quarter size’ layer mode to Grain extract. This will give you a predominantly grey image with just the fine details or texture of the original.

Grain extractClick to enlarge

8. Select ‘copy visible’ from the Edit menu. Paste this and make it a New Layer – Name this layer ‘Texture’

9. Make the ’16th size’ and ‘quarter size’ layers visible. Hide the others. Set the ’16th size’ layer mode to ‘Grain extract’

10. Select ‘copy visible’ from the Edit menu. Paste this and make it a New Layer – Name this layer ‘Features’

11. Delete the ‘Quarter size’ layer. Rename the layer ’16th size’ layer as ‘Shape’ and set the mode to ‘normal’ . Arrange the layers so in this order, top to bottom. Texture, Features, Shape, Background.

12. Set both ‘texture’ and ‘features’ layers to ‘Grain merge’. This will make it look like you have your original image back. Try hide different layers to see what happens.

Layers after the set-up is complete

- What you have done is split your image into three layers based on the size of the objects in the image. The ‘texture’ layer has only small sized objects in it. The ‘Shape’ Layer has only large sized objects in it. The ‘features’ layer has medium sized objects in it. Now we can edit different sized objects largely independently of the others.

Part 2 – Let the healing begin

1. Zoom in to 100%. Find the part of the image you want to edit. Show only the ‘Texture’
layer. You may need to engage the ‘Display filters’ Contrast setting to get a better idea of what you are doing

2. Select a hard edged brush. Clone over the wrinkles near the eye.
Texture clone

-Make all layers visible. You will see that most of the wrinkles have gone, and the skin looks realistic. The large dark wrinkle below the eye still exists, but we will remove that.

The 3 stages

3. With all the layers visible, add a Mask to the ‘Features’ layer. Using a soft edged brush paint black onto the Mask in the position of the dark wrinkle below the eye. It should disappear. If you are keen, you can paint black onto the mask where there are any small blemishes.

Features maskClick to enlarge

If you decide that the fine texture is to great (e.g. skin pores too obvious), add a mask to the texture layer use it to vary the opacity of the layer in selective spots.

The final result (109kb):
The result. 109kbClick to enlarge

Notes

  • When you are resizing your different layers, keep in mind the size of the ‘texture’ in the picture. For large images you may need to resize the layers by 1/8th and 1/64th. Some trial and error may be required.
  • When you are using the mask on the features layer you will find that things may start to look a bit strange near edges. Instead of using the mask to make the layer transparent, you may find you get a better results by blurring, or cloning the features layer.
About these ads

5 responses to “How to ‘heal’ photos without the magic tool.

  1. Thanks for this very nice tutorial.

    regards

  2. Peter Wolkensdorfer

    I did the tutorial step by step, and the result is amazing. The skin indeed remains natural, with the wrinkles and blemishes all gone. Thanks for the tutorial!

  3. This is incredible – thanks for sharing (and your update).

    What you’re doing here (in your original version) is essentially a manual wavelet transform. This can now be done automatically via a plug-in, which you might be interested in – it allows fine adjustment at various layers – though your technique (particularly the updated one) works fine.

    See the “Wavelet decompose” plug-in:

    http://registry.gimp.org/node/11742

    • Thanks Nils,

      I am aware of the ‘Wavelet decompose’ plugin and have been using it extensively rather than using this technique. What I’d really like to see is an automatic version of this technique using a median filter, or even some other edge preserving filter(bilateral filter?), to produce similar output to the wavelet decompose plugin. This would allow the edges to be removed from the texture layer, leaving mostly texture. Alas, I am no programmer and I think it may be to obscure for anyone to take up the task.

  4. Pingback: Splitting an Image | Mr. Me's Pictorial Wonder

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s