RSS/Atom feed Twitter
Site is read-only, email is disabled

Search and replace text in text layer

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

Search and replace text in text layer rtsnhatl 30 Nov 17:58
  Search and replace text in text layer Chris Mohler 30 Nov 18:24
   Search and replace text in text layer Sven Neumann 01 Dec 21:13
  Search and replace text in text layer Chris Mohler 01 Dec 00:22
2008-11-30 17:58:07 UTC (about 16 years ago)
postings
1

Search and replace text in text layer

Is there any way either by scripting or externally to search and replace a text string in GIMP. I have several images that have multiple text layers, I would like to have a template image that I can just do a search and replace of the text strings to create a new image. Thanks in advance

Chris Mohler
2008-11-30 18:24:03 UTC (about 16 years ago)

Search and replace text in text layer

On Mon, Dec 1, 2008 at 10:58 AM, Bob S. wrote:

Is there any way either by scripting or externally to search and replace a text string in GIMP. I have several images that have multiple text layers, I would like to have a template image that I can just do a search and replace of the text strings to create a new image. Thanks in advance

Well, I did not really think that this would work, but it did:

I created a file called test.xcf with one text layer containing the word "test".

Then I used this command: cat test.xcf | sed 's/test/TEST/g' > test2.xcf

And "test" was replaced with "TEST". Whether or not this method will work for more complex documents I do not know. And of course I'm running linux, so if you are on windows you will need to use another program (IIRC cygwin has 'sed').

I see in the procedure browser that there are ways for a plugin to get and select text - so it seems possible to write a plug-in for find/replace instead. That would probably be a better method than "brute force" with sed.

HTH,
Chris

Chris Mohler
2008-12-01 00:22:04 UTC (about 16 years ago)

Search and replace text in text layer

On Mon, Dec 1, 2008 at 10:58 AM, Bob S. wrote:

Is there any way either by scripting or externally to search and replace a text string in GIMP. I have several images that have multiple text layers, I would like to have a template image that I can just do a search and replace of the text strings to create a new image. Thanks in advance

Hi Bob,

I wrote a small plug-in that might work: http://registry.gimp.org/node/12212

Place it in your GIMP plug-in folder, and be sure that the file is set to be executable and that you have Python installed. I've done limited testing but it seems to work OK (2.6.x). Upon opening or creating an image, the plug-in is found at Edit->Find & Replace Text...

HTH,
Chris

Sven Neumann
2008-12-01 21:13:19 UTC (about 16 years ago)

Search and replace text in text layer

Hi,

On Mon, 2008-12-01 at 11:24 +0000, Chris Mohler wrote:

I created a file called test.xcf with one text layer containing the word "test".

Then I used this command: cat test.xcf | sed 's/test/TEST/g' > test2.xcf

And "test" was replaced with "TEST". Whether or not this method will work for more complex documents I do not know.

That will only work if the replacing string has the same number of characters (or actualy number of bytes in the UTF-8 encoded text). Please don't do such things. As you found out already, GIMP 2.6 provides an API in the PDB that allows to do text layer manipulation.

Sven