I have a number of images that have all the same background but each has different text overlaid (they are covers of a magazine journal).

I don't have access to the background image, but I know that I can create a composite of the covers and get the background that way.

I can do this manually with a photo-editing program by moving from layer to layer but I'm wondering if there's a tool or filter that automates this (ideally one I can use in Gimp, since I don't have Photoshop).

3 Answers 3


BgMask is a script that does what you want. It has automatic and manual background extraction mode. Load your images as layers and do Extract Background, and if that leaves artifacts, use manual background extraction tool. See also a video tutorial.


Stack/align the images and Use a "Median filter" (there is one in the GMIC filter collection)(*). For each pixel it takes the median value of the same pixel across all images, which in most cases will be the most frequent value . If there is no too much text and the text position is sufficiently random, that most frequent value will be the background value.

(*) If you don't want to install GMIC for this (but it is fairly useful otherwise) there is a pure Python one here.


I don't know of any general way to do that, and indeed, in some cases an automatic solution might not even be possible without some way to distinguish the text from the background. (You could, for example, decide that the color a given pixel had in a majority of the images was the background, but that could fail for pixels that were actually covered by text in all but a few of the images.)

However, in some special cases there do exist simple solutions. For example, if the text was always darker than the background, then you could simply open all the images as layers, change their blending mode to "Lighten only" and merge them.

Of course, for light text on a dark background, the same trick could be used with the "Darken only" mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.