5

I want to add some text to an image in Gimp with the Text Tool, such that the background of the text layer (a rectangle) is of a fixed color instead of the default transparent background to make the text more readable.

I can get it to work by duplicating the layer and using bucket then merging layers, or by removing alpha and color mapping, but those methods are cumbersome, and if I want to edit the text further, I have to start from scratch.

Is there a better method where I can just type and have the background the color that I want it and still be able to edit the text freely, i.e. without rasterizing the text first, and have the background of my chosen color automatically resize to the text?

I saw this question: Can I change the default Gimp transparent background to white? but I don't see how to change the fill type of a text layer, which gets automatically created when I start using the Text Tool.

Tested in Gimp 2.10.18.

0

5 Answers 5

4

In GIMP text layers don't have a background colour. So, what you want isn't possible.

To have a background you'd need to create a new layer under the text layer, select a rectangle to surround the text, then fill it with colour.

If you change the text, you would need to delete the filled layer, make a new rectangle layer to fit the new text, and fill it again.

There's nothing that will do this automatically in GIMP, unless you can find a script, or write one yourself.

Also note that GIMP isn't designed for text/page layout. It's photo editing software. If you find yourself doing things like this regularly, then perhaps consider using some page layout software instead, where it is possible to create filled boxes and to type text inside them.

2
  • Thanks Billy, do you know if there's an open source option for this? Jun 28, 2020 at 15:47
  • 1
    @CiroSantilli郝海东冠状病六四事件法轮功 Scribus is Open Source page layout software. However, in Scribus a text box will not expand automatically. Text can however be put inside a text frame which can be resized manually, and the text frame itself can have a colour, while the text can have another colour.
    – Billy Kerr
    Jun 28, 2020 at 23:06
2

Using both techniques above worked for me.

I had to replace the dimensions in jpg because they were too small.

  1. Add the text box to your image.

  2. Make sure the text box is tight to the text (Rectangle on bottom left corner).

  3. Duplicate the layer by right-clicking on the layer and selecting "duplicate layer".

  4. Select the original layer by clicking on it in the layers list (one below the one you just created).

  5. Goto edit and select "Fill with FG color". Assuming that the FG color is set to the color you want behind your text.

Note: One other great tip I found is to hold shift when you have to move text as this causes the selected layer to move. It is hard to select text because most of it is empty.

1

Add background color to a text box in a photo:

  1. Add the text box to your photo
  2. Go to Edit top Left
  3. Click on Add FG Color from the dropdown menu.
  4. Select your preferred color.

Done.

2
  • What version of The GIMP are you using. I am rocking version 2.8.14 and the stated option is not available...
    – Digger
    May 15, 2021 at 21:41
  • Doing this fills the entire photograph with color - not just the text box.
    – Stan
    May 16, 2021 at 22:26
0

Nobody is looking for "text/page" layout necessarily. They (me, for instance) simply want text on a plain background so's it is readable. That should be easy in a layered image manipulation programme surely? We just need it made on a layer. Well we get a text layer with gimp. But no background. So we need a transparent background layer underneath the text that has an opaque coloured block on it for the text to go over. Extra functionality if we can merge those two layers. Easier to handle. Extra functionality now because we can move that merged layer any place we want. But ignore the 'extras' and merge all down in to one image and there it is. And that's 'image manipulation'. Not 'text layout'.

0

GIMP 2.8.18

Easy and quick:

Add the desired text - suggest you "pad" the ends of the text string with spaces (will look better when done).

Get the desired background color set up (generally at the bottom of the toolbox). I've selected white as the background color below:

Background Color Selected

With the newly created text box still selected, Edit -> Fill with BG Color

Said newly created text box will now be a solidly-colored rectangle.

With the Text tool selected, left-click on said solidly-colored rectangle. This will pull up a Confirm Text Editing box. Click the Create New Layer button. You may have to adjust the position of the now-visible text box a bit...

Done.

Your Answer

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

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