dont know if this dreamt up or not, first i prompted chatGPT to give me GIMP 3.0 plug-in that changes background color
then it gave me what looked like 2.10 then i told it that's 2.10 then it dreamt up this
import gi
gi.require_version("Gimp", "3.0")
from gi.repository import Gimp, GObject, GLib
# Define the function that will perform the color change
def change_background_color(procedure, run_mode, image, drawable, r, g, b):
# Start undo group
Gimp.context_push()
Gimp.image_undo_group_start(image)
# Convert RGB to GIMP's color format
color = Gimp.RGB()
color.set(r / 255.0, g / 255.0, b / 255.0)
# Fill the layer with the specified color
fill_options = Gimp.FillOptions()
fill_options.set_color(color)
drawable.fill(Gimp.FillType.BACKGROUND, fill_options)
# End undo group and clean up
Gimp.image_undo_group_end(image)
Gimp.context_pop()
return procedure.new_return_values(Gimp.PDBStatusType.SUCCESS, GLib.Error())
# Register the plug-in
class ChangeBackgroundColor(Gimp.PlugIn):
__gproperties__ = {
"r": (int, "Red", "Red color component", 0, 255, 255, GObject.ParamFlags.READWRITE),
"g": (int, "Green", "Green color component", 0, 255, 255, GObject.ParamFlags.READWRITE),
"b": (int, "Blue", "Blue color component", 0, 255, 255, GObject.ParamFlags.READWRITE)
}
def do_set_property(self, prop, value):
if prop.name == "r":
self.r = value
elif prop.name == "g":
self.g = value
elif prop.name == "b":
self.b = value
def do_get_property(self, prop):
if prop.name == "r":
return self.r
elif prop.name == "g":
return self.g
elif prop.name == "b":
return self.b
def do_query_procedures(self):
return ["python-fu-change-background-color"]
def do_activate(self):
pass
def do_create_procedure(self, name):
procedure = Gimp.ImageProcedure.new(
self, name, Gimp.PDBProcType.PLUGIN,
change_background_color, None
)
procedure.set_image_types("*")
procedure.set_documentation(
"Change the background color of the active layer",
"Changes the background color of the active layer to the specified color",
"Your Name"
)
procedure.set_menu_label("Change Background Color")
procedure.set_attribution("Your Name", "Your License", "2024")
procedure.add_argument_from_property(self, "r")
procedure.add_argument_from_property(self, "g")
procedure.add_argument_from_property(self, "b")
return procedure
Gimp.main(ChangeBackgroundColor.__gtype__, sys.argv)
Tested this in 2.99 doesn't work looks like ChatGPT is hallucinating, unless it works in 3.0 and 2.99 isn't 3 I dont 'know
Where can i download 3.0?