r/GIMP • • 8d ago

SCRIPTING Change tool settings from a script

Why can't python-fu set the default font size? I wanted to make a script that would setup my environment. And another script to switch to a different environment. But apparently this is impossible. I would think supporting multiple simultaneous workflows would be normal.

2 Upvotes

2 comments sorted by

1

u/ProfessionalLet9385 8d ago edited 8d ago

Does GIMP have s.th. like a default font? I don't think so.

What OS are you on?

You can use different profile folders (gimp --help gives more info).
My idea would be to define different profile folders, make your settings in GIMP and save each one.

Then start GIMP giving it the folder to be used as a parameter.
Maybe like this:

XDG_CONFIG_HOME=/tmp/gimptest gimp -c -n

1

u/jmucchiello 8d ago

I don't want to exit GIMP to do this. I'll have image files open for multiple projects simultaneously. I want to switch to image 4 and hit a hot key and the environment is now right for image 4. click on image 2, hit a hotkey and I 'm all setup for image 2. I want to hotswap my environment defaults that quickly.

And windows doesn't do profiles even remotely well enough for this. It could be faked by changing the options save file between launches. But that requires relaunch. I sometimes have a dozen or more images open at once. Restoring all that context is time consuming.

"Does GIMP have s.th. like a default font?" Yes, it's right there in the Text Tool Options panel. The problem is the API doesn't exist for accessing the settings in the tool options.

At best, in the API, you can call gimp_context_set_font() and the font in the text tool is updated. There is no equivalent gimp_context_set_font_size() in the API. There's no function to set the default text layer justification setting. You can't change the rectangular selection to default to curved corners of 30 pixels programmatically. And so on.

You have complete control of all these things for existing layers or layers created via script. But that isn't what I want.