Script-Fu

Extend Script-Fu to include additional functions that help the user.

Key Concepts and Definitions

  • Script-Fu: A scripting language based on Scheme

Additional Procedures


Display Functions

CommandPurpose
(gimp-context-get-display)Get the active display ID

Implementation: This function retrieves the active display ID which can be used with other display-related functions like (gimp-display-present display-id) for script automation and display management.


Eraser Toggle Functions

CommandPurpose
(gimp-context-eraser-toggle)Toggle the active tool to the eraser
(gimp-context-eraser-paintbrush-toggle)Toggle the active tool to the eraser and always return to the paintbrush
(gimp-context-get-eraser-active)Returns true if the Eraser Tool is active

Implementation: These functions enable seamless tool switching, allowing scripts to toggle between the eraser and other painting tools. The paintbrush toggle ensures consistent tool return behavior for predictable workflows.


Visibility Functions

CommandPurpose
(gimp-items-set-visible)Set the visibility of a vector list of items

Implementation: Allows setting the visibility of a vector list of items in bulk, streamlining visibility management for layers, paths, or other drawable items in complex compositions with many elements.


Brush Control Functions

CommandPurpose
(gimp-context-get-brush-eraser-scale)Returns the Paint Tool eraser scale
(gimp-context-get-brush-jitter)Returns the Paint Tool jitter slider value
(gimp-context-set-brush-jitter)Set all the Paint Tools jitter slider values

Implementation:

  • Eraser Scale: Gets the Paint Tool eraser scale option for use with eraser toggles, allowing painting tool presets to have specific sized erasers. Erase pencil lines with a big eraser, cut into brush strokes with a smaller eraser.
  • Jitter Control: Enables getting and setting jitter values across all Paint Tools (eraser, paintbrush, airbrush, pencil) for consistent brush behavior and seamless tool switching.

Layer Functions

CommandPurpose
(gimp-layer-combine-alpha)Combine the alpha channels of two layers

Implementation: This procedure combines the alpha channels of two layers and writes the result into the first layer’s alpha channel using operations like ADD, SUBTRACT, INTERSECT, or REPLACE for advanced compositing workflows.