To undo the 50% white overlay, you want a color transformation that:
- maps 50% gray to black, and
- keeps pure white unchanged.
Among the GIMP layer modes, the Burn mode turns out to do what you want, if the color of the Burn layer is 50% gray (
"Burn mode inverts the pixel value of the lower layer, multiplies it by 256, divides that by one plus the pixel value of the upper layer, then inverts the result."
Thus, if you create a new white layer, set its blending mode to Burn, and then draw an exact copy of the original overlay in 50% gray onto that layer, it should cancel the overlay exactly.
Does it? Let's try it out.
Here's our test image — a basket of mushrooms with a layer of white text over it:
Original picture from Wikimedia Commons, released into the public domain by author George Chernilevsky.
Now, I could've cheated and just used a copy of the text layer as my burn mask, but in practice, you'd typically have to reconstruct the mask by hand. So what I did was use the Magic Wand tool (with the threshold set to 25; you'll need to tweak this for optimal results) and try to select as much of the text as I could, without going (too much) outside it. Then I switched to my new white layer, and filled the selection I'd obtained with 50% gray:
Of course, I could've improved this mask further with manual tweaking, but I deliberately went with this imperfect mask for demonstration purposes. Changing the blending mode of this mask layer to Burn, here's the result:
Note how minor traces of the overlay remain in places where the mask is not 100% accurate, and there's also some left-over JPEG compression noise visible in the de-masked areas, but most of the image is nearly perfectly reconstructed.
(If I'd used an exact copy of the text overlay for the burn mask, and hadn't saved the image in a lossy format before attempting to reconstruct it, the result would've been visually indistinguishable from the original. Actually, that's what I did at first, but I felt that made for a rather boring and somewhat unrealistic demonstration.)