Welcome to Python! Coming from Script-Fu gives you a head start. Using AI carefully and intelligently is super helpful (I do it myself).
Since you asked, here’s some thoughts about the plugin files you shared.
filmemulation.py
Good call on keeping the filters as DrawableFilter live layer filters. When possible, use layer filters appended to a layer, not merged, because that delivers non-destructive editing to your users.
The Aerochrome layer approach needs a rethink. Globally rotating hue 180° doesn’t result in a film emulation. It’s a crude global hue shift that may look Aerochrome-ish on some images but way off on others.
Aerochrome’s infrared-sensitive layer records vegetation red/magenta, while treating blues and skin tones differently. It transforms colour per-range, not just on one axis.
The right tool is probably gimp:hue-saturation with its range property targeting specific hue ranges independently. In GIMP 3 the range enum values are:
Gimp.HueRange.ALL
Gimp.HueRange.RED
Gimp.HueRange.YELLOW
Gimp.HueRange.GREEN # foliage — shift toward red/magenta
Gimp.HueRange.CYAN
Gimp.HueRange.BLUE # sky — adjust separately
Gimp.HueRange.MAGENTA
You set range first, then set hue, saturation, and lightness. A more accurate Aerochrome emulation would shift greens toward red and adjust their saturation, handle blues separately, and make any shifts independent and user-controllable. You could do multiple passes through gimp:hue-saturation with different range values, all stacked as non-destructive filters on the same layer. Layer filters are cumulative, and their order matters. This approach gives you much more creative control.
About the hue_value introspection approach:
hue_pspec = hue_cfg.find_property("hue")
hue_value = getattr(hue_pspec, "maximum", 1.0)
hue_cfg.set_property("hue", hue_value)
It tries to find the maximum normalised value as a substitute for 180°. That’s fragile. find_property() returns a property specification, but getting a known constant through introspection adds unnecessary complexity. If you continue using gimp:hue-saturation for a global rotation, just hardcode 1.0 and add a comment explaining that it represents 180° in GIMP’s normalised hue range.
This file has no exception handling in do_create_procedure(). If any step in the plugin setup fails, the procedure may not be registered correctly, and the user may not get a useful error message. I’d wrap the procedure setup in try/except blocks and report any errors so users know what went wrong and what to report.
digitalinfrared.py
This gives users a live preview with debounce, undo group handling, and selection save/restore. All good.
But the apply_gegl helper has a significant problem, and it’s a good example of plausible but counterproductive AI-generated code:
def apply_gegl(drawable, op_name, **props):
flt = Gimp.DrawableFilter.new(drawable, op_name, op_name)
cfg = flt.get_config()
for key, value in props.items():
cfg.set_property(key.replace("_", "-"), value)
drawable.append_filter(flt)
drawable.merge_filters() # <-- called after every single append
merge_filters() bakes your filters into the layer, with no way to edit them as live filters. Calling it inside a helper that runs multiple times means GIMP does a full pixel merge on every iteration. That wastes time on repeated processing while losing non-destructive editability. If the intent is a destructive bake, do it once at the end. If the intent is non-destructive, use append_filter() instead, and be careful about how many times you loop around an operation.
Hardcoded values are problematic in general. In this case, values like r = 0.10, g = 0.90 + 1.30 * foliage, blur = max(1.0, big * 0.004), SKY_BLUE = "#7fb0ff" are all parameters buried in the code. Values like channel mixer base weights, the sky colour, the blur scaling factor should be exposed as procedure arguments with sensible defaults, the same way foliage, sky, and detail already are. Where a value is genuinely a fixed internal constant, name it at the top of the file rather than leaving numbers in the middle of calculations.
Exception handling is minimal. Defensive programming helps avoid unnecessary support requests, and it requires handling foreseeable failure cases properly. Your broad except Exception blocks in rebuild() and run() catch everything but tell you little. During development at least, tracebacks give focused details that help with troubleshooting:
import traceback
# ...
except Exception as exc:
Gimp.message("Error: %s\n%s" % (exc, traceback.format_exc()))
I find full trace information invaluable in my attempts to harden my plugins. Silent failures are very hard to debug.