It is currently Fri Apr 19, 2024 12:49 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Photo Restoration: Removing scratches and stains
PostPosted: Tue Jul 23, 2013 10:25 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Nov 09, 2011
Posts: 726
GIMP has very good tools to remove scratches and stains manually, but why waste time that laborious work if we can make the task almost automatically?. Currently in GIMP we have the ability to use two filters for "smart filling/painting" zones of an image: Resynthesizer and G'MIC inpaint patch based filter. If you have ever done this kind of work manually, you'll know why you should be eternally grateful to these two great filters.
The general idea of this method is on a transparent layer over the copy of the original photograph, paint over the scratches and stains with the pencil tool and a solid brush, then apply filters.
We will work on a portion of the next old picture to show how to restore it:
viewtopic.php?f=18&t=8017
This will be our workflow in GIMP:
Image
Then, open your original photograph in GIMP. You always work on a copy of the original photograph, leaving the original bottom. Then duplicate the original photograph with Duplicate Layer. Create a new transparent layer above that copy layer (Layer > New Layer). Select that new transparent layer in the field of layers to the right of GIMP. Select the Pencil Tool and a hardness/solid brush. Select brush size to cover the scratches but do not over way too. Paint scratches and stains filling them completely, barely exceeding the limits of the edges. You remember that you can draw straight and contiguous lines drawing a single point with a simple click at the start of the scratch, then hold down the Shift key and draw with a simple click a new point at the end of the scratch.The idea is that your work looks like this:
Image
I will not stop in explaining how to install the filters. I will not explain each filter settings too. So, we will use the default settings in each filter. Then you can research and experiment on your own.
Well, now to apply filters:

* Resynthesizer
1- Select the transparent layer where you had painted with the pencil tool in the field of layers to the right of GIMP.
2- Click on "Select by Color" tool. To the left of GIMP you choose a "Treshold" value of approximately in 50.
3- Having selected the transparent layer, on the image you pick on an area painted with the pencil. In this way you select all the areas painted with the pencil.
4- Now you select the "Original copy" layer in the field of layers to the right of GIMP.
5- Choose from Filters > Enhance the filter "Heal Selection" (remember that you must have installed the Resynthesize plugin) and apply the filter with the default values​​. Go to Select > None. Uncheck "Item Visibility" in the transparent layer, and you'll see the magic happened.

* Inpaint patch based (G'MIC)
1- Select the transparent layer where you had painted with the pencil tool in the field of layers to the right of GIMP.
2- Open G'MIC from Filters > G'MIC (remember that you must have installed the G'MIC plugin)
3- To the left of G'MIC in “Input/Output” properties in Input Layers you choose “Active and Below”
4- Under Repair filters menu chose “Inpaint [patch-based]” filter.
5- Right on G'MIC you choose in Mask Type, “Opaque regions in top layer”, and click the "OK" button. Again, the magic happens.
======================
Remember to experiment with different values ​​in each filter.
There are times that in some areas the filters do not work well. That is the reason why we should always leave the original image intact under all the layers to be able to further adjustments in our photo manipulation.
With this method you can also remove wires or anything you want, or use this method for modeling/fashion purposes, to remove pimples or skin moles for example.
Image

_________________
Image
Be patient, English is not my language.


Last edited by YAFU on Tue Jul 23, 2013 11:49 am, edited 6 times in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Photo Restoration: Removing scratches and stains
PostPosted: Tue Jul 23, 2013 10:38 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Aug 30, 2012
Posts: 2174
Thanks for the tut.

_________________
Image


Top
 Post subject: Re: Photo Restoration: Removing scratches and stains
PostPosted: Tue Jul 23, 2013 11:02 am  (#3) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 5128
Location: Metro Vancouver, BC
Nice tutorial YAFU, I love the before, during & after animation!

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Photo Restoration: Removing scratches and stains
PostPosted: Tue Jul 23, 2013 11:09 am  (#4) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
Very nice YAFU, that looks like a heck of a lot of work you did there. KUDO's

_________________
Image


Top
 Post subject: Re: Photo Restoration: Removing scratches and stains
PostPosted: Tue Oct 20, 2015 2:49 am  (#5) 
Offline
Global Moderator
User avatar

Joined: Apr 01, 2012
Posts: 7712
Location: On the other side of this screen
Not been able to work this filter successfully yet. Maybe my settings were all wrong.

_________________


Top
 Post subject: Re: Photo Restoration: Removing scratches and stains
PostPosted: Tue Oct 20, 2015 3:32 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
YAFU,

Great tutorial. I have used both these filters for photo restoration, but the thing I have just learnt is your method of selection which makes it much more efficient!

david.


Top
 Post subject: Re: Photo Restoration: Removing scratches and stains
PostPosted: Tue Oct 20, 2015 5:33 am  (#7) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
sallyanne wrote:
Not been able to work this filter successfully yet. Maybe my settings were all wrong.

if you like, you can post your damaged photo here and see which should be the most appropriate parameters

_________________
"Where am I ?"


Top
 Post subject: Re: Photo Restoration: Removing scratches and stains
PostPosted: Tue Oct 20, 2015 7:40 am  (#8) 
Offline
Global Moderator
User avatar

Joined: Apr 01, 2012
Posts: 7712
Location: On the other side of this screen
Thanks dinasset but I work on many photos (Mostly old, creased, folded, cracked - pieces completely missing, water damaged, printer or scan marked, stained and drawn on). Can't remember which ones I have tried the filter on. (Gave up after trying it a few times). Think I usually ended up with photos that lost most of their detail, but then I didn't try Yafu's tut.
Thanks for showing us how to use it.

Will post one here at a later date maybe.

_________________


Top
 Post subject: Re: Photo Restoration: Removing scratches and stains
PostPosted: Thu Jun 11, 2020 11:57 am  (#9) 
Offline
New Member

Joined: Jun 11, 2020
Posts: 1
Hello

I have been looking for 40 minutes how do you choose "in Mask Type, “Opaque regions in top layer”?


Top
 Post subject: Re: Photo Restoration: Removing scratches and stains
PostPosted: Thu Jun 11, 2020 12:25 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Maybe G'MIC has changed in seven years...

_________________
"Where am I ?"


Top
 Post subject: Re: Photo Restoration: Removing scratches and stains
PostPosted: Thu Jun 11, 2020 4:15 pm  (#11) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2020
Posts: 111
Location: Quantumverse
Gizmo wrote:
I have been looking for 40 minutes how do you choose "in Mask Type, “Opaque regions in top layer”?

Image

2013


Removed in 2015 update.
Paint on the photo, transparent layer not required.


Top
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Stains on snake scales

12

No new posts REAL ESRGAN and GFPGAN open sourc (Face and Image restoration AI)

3

No new posts Attachment(s) Removing flare

2

No new posts Help removing mask from face

2

No new posts Attachment(s) removing px from the bottom of a image

4



* Login  



Powered by phpBB3 © phpBB Group