Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programmatic XCF text layer editing
#2
gimpfu is only "visible"  when the script is run from Gimp (either as a plugin or as a batch). So you don't have to tweak paths to be able to import it. In fact, I do run scripts "raw" form the command line, and I know that when I get to the import gimpfu error there are no remaining big syntax errors like unmatched parentheses or quotes or code indentation problems and I can try my luck with Gimp.

One problem you may have however in 2023 is that Gimp still relies on PythonV2, which has been deprecated in 2020, so 1) it is not always installed by default in your distro, and 2) when it is installed (by default or explicitly), the Gimp bit that enables Python is not. All isn't lost however, there are several ways to run Python scripts in Gimp on recent distros.

Then it is just a matter of traversing the layers, using pdb.gimp_text_layer_get_text(layer) and pdb.gimp_text_layer_set_text(layer, text).

I do have a script that does something similar (changes the font instead of the text), see ofn-replace-font here.
Reply


Messages In This Thread
RE: Programmatic XCF text layer editing - by Ofnuts - 02-11-2023, 05:43 PM

Forum Jump: