What you are thinking of is seam carving. The example you are thinking of comes from the Wikipedia article of the same name. Photoshop implements this and calls it "Content-aware scaling" and the GIMP calls it "Liquid Rescale".
oh, I could have used "liquid rescale" :P
I just remembered the idea of doing a thing like this, but I did not bother to search for the exact Question in PhotoSE to check for the tools to do it. And so I did it manually.
And, bytheway, it was not a lighthouse but a sort of castle in that photo :)