I have two images:
and one with a black background
How can I remove the difference and replace it with transparency using GIMP?
I have two images:
and one with a black background
How can I remove the difference and replace it with transparency using GIMP?
Using a Difference blending mode to create a mask won't really work with these images, because the word "studio" is in black on one image, but white on the other. The word "Amazing" is also different in each image, and the red dot of the "i" isn't identical in both images either, as @xenoid points out in a comment.
I mean you could try it and see for yourself. Put the black background image above the white, and set the layer blending mode to difference. Create a new layer from visible, invert it, and copy and paste the result into a layer mask on the white background version, and anchor it. Delete the unwanted layers. But the mask will need considerable fixing.
In my opinion, you don't need to do any of that anyway. The image with the white background already has enough contrast to make a pretty good selection of the white background. My approach would be similar to xenoids answer, except that I'd probably use the selection to create layer mask - which gives you a little more leeway to fix things if the mask isn't quite right.
My usual technique (applies to both):
Select > Grow
by one pixel so that the selection includes a one-pixel edge of the previously un-selected areasFill whole selection
Composite image of the results, over contrasting background to check the edges:
Color erase
painting...If you image has a strong contrast (says, black text on white) you don't even need the selection. The selection is only used to keep opaque areas of the subject that could have some erasable color.
Here's another method, this time to counter the problem of anti-aliased pixels in the mask leaving an outline of greyish pixels, and also keeping the anti-aliasing of the original intact so that the edges look smooth and not jagged.
Open the image with the white background, right click it in the layers panel, and choose Add Alpha channel. If this option is greyed out, there's already an alpha channel and you can skip this step.
Select all the white areas using the Fuzzy Select tool, including the insides of the letters A,a,D,O, and also not forgetting the 4 little white triangles in the logo. Holding down Shift as you click allows you to select multiple areas.
Do Select > Grow, by 1px
Do Select > Invert
Create a new transparent layer and drag it to the bottom of the layers stack
Select white as the foreground colour in the toolbar, and do Edit > Fill with FG color. This will fill the selection with white. This layer will act as a base fill layer.
Do Select > None
Select the top layer in the layers panel
Do Colors > Color to Alpha, and click OK
Here's the result
Add a contrasting fill underneath, and zoom in. There should be no problematic pixel outline. Here's part of the image at 100% zoom
Note: If you think the logo has become too light here, you can duplicate the color to alpha layer, and adjust it's opacity to adjust the lightness/darkness.
Color erase
is a better way in 2.10 (it can also be used by painting a layer above, and setting the layer to Color erase
).