Post Reply 

Removing Overlays

Sep 9, 2011, 22:13
Post: #1
Removing Overlays
If I have a picture with a transparent overlay, along with a nontransparent version of the overlay, is there a way I can remove the overlay from the original image?

One application for this would be removing GUIs from video game screenshots.
Find all posts by this user
Quote this message in a reply
Sep 9, 2011, 23:09
Post: #2
RE: Removing Overlays
Depends what you call a "transparent overlay"

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Sep 10, 2011, 00:03
Post: #3
RE: Removing Overlays
Something like this:
[Image: 5l6kbm.png]
Find all posts by this user
Quote this message in a reply
Sep 10, 2011, 09:29
Post: #4
RE: Removing Overlays
Is this the non-transparent version of the overlay? Can you upload both the picture and the non-transparet overlay you were talking about?

[Image: 6216880253_3c00e6165e.jpg]

Love your Gimp!
Visit this user's website Find all posts by this user
Quote this message in a reply
Sep 10, 2011, 10:16 (This post was last modified: Sep 10, 2011 10:19 by diginin.)
Post: #5
RE: Removing Overlays
(Sep 10, 2011 00:03)Jacob_ Wrote:  Something like this:
....

With clone tool, you can get very good results.

Look at the results. http://screencast.com/t/hPGOAU2aR This was 5 minutes work, if you take your time, you can get great results.

[Image: 6216880253_3c00e6165e.jpg]

Love your Gimp!
Visit this user's website Find all posts by this user
Quote this message in a reply
Sep 13, 2011, 20:05
Post: #6
RE: Removing Overlays
Okay, there is way, let's do some math. A transparent overlay is create by applying a semi transparent layer over the image. This is called "alpha compositing" (you can look it up on Wikipedia). Let's call "alpha" the opacity of the watermark (0 or 0% is fully transparent, 1 or 100% is fully opaque).

When you apply the compositing formula, this gives:

Final = (Overlay * alpha) + (Original * (1 - alpha))

and if you work out the equation:

Original = (Final - (Overlay * alpha)) / (1 - alpha)

So, one can go back (in theory, at last) to the original... but how does that translates in Gimp?
  • Overlay * alpha is just the original Overlay with a transparency set to alpha using the big slider in the Layers dialog.
  • Final - (Overlay * alpha) is the above, in subtract mode over our watermarked image.
  • (Final - (Overlay * alpha)) / (1 - alpha) is a gray layer (100%- alpha), in divide mode over the above.

OK, let's try... we apply an overlay or three circles (black, random, white) over some iconic face:
[attachment=653]

Load the original overlay, make it 25% opaque, and subtract it:
[attachment=654]

Get a selection from the original overlay (alpha to selection), create a transparent layer, fill the selection with 75% gray (100%-25%) (in the color dialog: H=any, S=0, V=75), and put it in divide mode:
[attachment=655]

Pretty good for the black and the random... let's see how by making the difference between the original and the recovered version:
[attachment=656]

There is indeed very little left of the black cross hatch...

Yes,results aren't perfect. For the white, I suspect (would have to do some more math) that at some places final image is really white and information on the original image is lost. It obviously works better for the darker tones, or maybe when the overlay is the opposite of the original image (but... this is also when it is the most visible). I ought to do some more math to see when limits are reached and information is lost...

OK, as some of you have discovered, I cheated.

I know how much opacity I applied for the overlay, so I can use that to optimize... however, I found an interesting thing: when you have the overlay in subtract mode, and play with its opacity, there is a very specific setting for which the image with the overlay turns some uniform gray. This is exactly when you are using the right opacity level. Read the value X on the opacity slider, and make a 1-X gray level "divide" layer, and you should be set.

Just give it a shot and report your results...

Some more thoughts: a script maven could make a script with a preview and a single cursor that controls the opacity of the overlay and the grayness of the divide layer. Then it would be a mere drag of the slider to find the optimal value...

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Sep 14, 2011, 07:35
Post: #7
RE: Removing Overlays
Thanks ofnuts. I was thinking that (using the mathematical overlay methodology) that it would be possible to do something like this, but I am not as deep in the subject matter as you are Smile I will play with your techniques as well. The "semi-standard" way I have seen is the clone tool, but I think your way does tend to be the more correct way.

[Image: 6216880253_3c00e6165e.jpg]

Love your Gimp!
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Removing time stamp from photos? beat connection 1 171 Sep 3, 2017 18:49
Last Post: ythgilb
  Removing the slivery sheen from a very old photo tranquilsea 5 408 Aug 7, 2014 18:20
Last Post: iForStyle007
  Removing background and seperating main logo from words dragonsfire1981 4 456 Jun 26, 2014 22:08
Last Post: ofnuts
  Removing background color doesn't work! Kalderyn 3 487 Feb 11, 2014 12:12
Last Post: ofnuts
  Removing Background from image gazza 3 538 Apr 4, 2013 03:04
Last Post: gazza

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS