AI Gimp Plugins - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: Other topics (https://www.gimp-forum.net/Forum-Other-topics) +--- Forum: Watercooler (https://www.gimp-forum.net/Forum-Watercooler) +--- Thread: AI Gimp Plugins (/Thread-AI-Gimp-Plugins) Pages:
1
2
|
RE: AI Gimp Plugins - inkdolls - 11-01-2024 Never mind abot the workflow files. I finally found that 'expot API' menu. (10-30-2024, 06:14 PM)nchen Wrote: I appreciate you helping me with bug fixingI'm glad to help. RE: AI Gimp Plugins - nchen - 11-01-2024 (11-01-2024, 12:33 AM)inkdolls Wrote: Okay, I know why the checkpoint was not being replaced: on line 26 of gp-generate-comfy-image.py, it says "CheckPointLoaderSimple" with a capital P in "Point", but the node is named "CheckpointLoaderSimple". Once I edited it, it runs fine. Understanding that part of the plugin was interesting. Ahh good to know! I just uploaded a fix that should make all node title searching non-case sensitive. RE: AI Gimp Plugins - inkdolls - 11-03-2024 Your change fixed it. I've been playing with this and there have been no more errors. I'm still just learning. It's great not having to use a web browser. I've only tried the image generation and image to image. I don't use loras very much but those work well. Looking at your files, you're using identical functions in many files. I don't know if you're aware that you can declare more than one plugin in one file calling register() repeatedly with different parameters for all the dialogs and a different function each time, so the basic code exists just once, making maintenance easier. After more than a decade writing plugins, I learned that only quite recently. RE: AI Gimp Plugins - nchen - 11-04-2024 (11-03-2024, 11:58 PM)inkdolls Wrote: Looking at your files, you're using identical functions in many files. I don't know if you're aware that you can declare more than one plugin in one file calling register() repeatedly with different parameters for all the dialogs and a different function each time, so the basic code exists just once, making maintenance easier. Thank you, that is very good to know! So essentially I just create one python file containing all of the plugins in a bundle? I had tried creating classes for the plugins but it became too convoluted, so I'll definitely have to give this a shot. I just manually copied and pasted all of the functions in alphabetical order, for each plugin... Hopefully things get a bit easier with GIMP 3 as well. RE: AI Gimp Plugins - Ofnuts - 11-04-2024 (11-04-2024, 02:48 AM)nchen Wrote:(11-03-2024, 11:58 PM)inkdolls Wrote: Looking at your files, you're using identical functions in many files. I don't know if you're aware that you can declare more than one plugin in one file calling register() repeatedly with different parameters for all the dialogs and a different function each time, so the basic code exists just once, making maintenance easier. You can indeed register several plugins in a single Python file, but since 2.10 you can also do something else: put all your "common" code in a separate module plug-ins ├── bar │ ├── bar.py │ └── libmodule.py ├── baz │ ├── baz.py │ └── libmodule.py └── foo ├── foo.py └── libmodule.py
RE: AI Gimp Plugins - nchen - 11-04-2024 (11-04-2024, 08:09 AM)Ofnuts Wrote: Thank you! That would save me a lot of time copying and pasting. I have been trying to implement this approach but I can't seem to get it to work. Do the functions in the 'libmodule.py' have to be registered similar to the GIMP plugins, even though GIMP doesn't check them? Also, are the input and output capabilities of functions within libmodule.py limited to GIMP's type codes (PF_INT, PF_FLOAT, etc)? I have tried both registering them and not registering them to no avail. For the example structure: plug-ins ├── bar │ ├── bar.py │ └── libmodule.py If I have a function within libmodule.py: Code: def insert_new_layer_with_alpha(image, width, height, name="New Layer"): I have also tried registering and then calling insert_new_layer_with_alpha directly without importing. I did test if the function within libmodule.py registers successfully to be sure it's not an error within the function. The only time I've been able to get bar.py to register is when I don't attempt to import or call the functions within libmodule.py. EDIT: A kind of funny workaround I've been using sometimes is just installing a newer python version on my machine and calling it from the plugins: Code: import subprocess RE: AI Gimp Plugins - inkdolls - 11-05-2024 Well, you got a more expert reply that I could have given. I think the idea is that libmodule.py can contain functions common to many plugins so an exact copy works for all of them and registration should be left to smaller files matching the directory names. From what I've read, Gimp 3 enforces that structure of plugin files in their own folders. (11-04-2024, 02:48 AM)nchen Wrote: So essentially I just create one python file containing all of the plugins in a bundle? I did that in the file I uploaded here. For me, it's convenient to pack two plugins in a small file. And now I wonder if that will work in future Gimp versions. RE: AI Gimp Plugins - nchen - 11-05-2024 (11-05-2024, 02:34 AM)inkdolls Wrote: Well, you got a more expert reply that I could have given..I appreciate all input, as you're all legends for a newbie like myself Separating out the plugins and using common libmodule files would help keep things organized. Long term, I'd love to add a lot of free, ethical AI features to Gimp. Ai upscaling and ai gif/animations come to mind. I'm pretty close on an AI gif optimizer (since every frame in AI animations is unique due to diffusion, annoying to optimize). RE: AI Gimp Plugins - Ofnuts - 11-05-2024 (11-04-2024, 08:13 PM)nchen Wrote: Thank you! That would save me a lot of time copying and pasting. I have been trying to implement this approach but I can't seem to get it to work. If you use the Gimp API in the "libmodule" it should also do the required Gimp imports. |