small plugin code help - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: small plugin code help (/Thread-small-plugin-code-help) Pages:
1
2
|
small plugin code help - gimpygirl - 02-29-2024 Hi I have this plugin that just runs some other scripts and plugins. I want to add the first 2 comments lines. Can somebody tell me if this is possible and fill in the required code? The plugin works but the 2 first comment lines I don't know how to code it. First I want to add an alpha layer to my image. Then I want to apply "select by color" tool on a specified pixel (X and Y value of the pixel) and delete the selection from the whole image automatically? Is this possible using code? Code: #!/usr/bin/env python RE: small plugin code help - Ofnuts - 02-29-2024 Code: #!/usr/bin/env python My own comments are prefixed with ###. Happy reading. RE: small plugin code help - gimpygirl - 03-01-2024 If I change it to Code: from gimpfu import * it still not appears in GIMP. What version you have? I don't know how to make that line https://developer.gimp.org/api/2.0/libgimp/libgimp-gimpimageselect.html#gimp-image-select-color How to make Code: GimpChannelOps operation and Code: const GimpRGB *color ? Can you please give example? I'm a beginner and it's too difficult. When I have my script, I stop with this. RE: small plugin code help - Ofnuts - 03-01-2024 The API you point to is the C API. The one you use is all documented here: [attachment=11334]
For the color part, you can use tuples (R,G,B) Code: # selecting blue (#0000FF) RE: small plugin code help - gimpygirl - 03-01-2024 I understand it now!!! All the GIMPies JUMP JUMP!!! All the GIMPies JUMP JUMP!!! All the GIMPies JUMP JUMP!!! gimpygirl is doing the Kirby Dance WooooWoooWoooWoooWooooooooooooooooooooooooooooooooo
So I just select a color with color picker and take the values of R, G and B in 0..255 range? See screenshot: this color has 15, 15, 45 and then just this as RGB value in the code?
RE: small plugin code help - Ofnuts - 03-01-2024 [0 .. 100] is really 0% .. 100%, or in other words [0.0 .. 1.0] so 50.0 is more or less the same as 127. [attachment=11340]
RE: small plugin code help - Ofnuts - 03-01-2024 (03-01-2024, 08:31 PM)gimpygirl Wrote: You didn't search much, did you? [attachment=11341]
(from that point of view using Gimp in English helps a lot because the API names are quite close to the names in the English UI...)
RE: small plugin code help - gimpygirl - 03-01-2024 (03-01-2024, 09:48 PM)Ofnuts Wrote:(03-01-2024, 08:31 PM)gimpygirl Wrote: Yes, I now see why I don't find anything "clear" gives 0 results if you use another language! You can't even find it when using translated words... So I think I switch gimp to English It doesn't work if I use this for selecting red. in gimp the selected color doesn't change (i have image opened) Code: pdb.gimp_image_select_color(image, CHANNEL_OP_REPLACE, timg, (255,0,0)) or this Code: pdb.gimp_image_select_color(image, CHANNEL_OP_REPLACE, tdrawable, (255,0,0)) What parameter must be in there? See my code in the beginning When this line works, the foreground color here should appear as the color you put in the code, right? RE: small plugin code help - Ofnuts - 03-02-2024 (03-01-2024, 11:18 PM)gimpygirl Wrote:(03-01-2024, 09:48 PM)Ofnuts Wrote:(03-01-2024, 08:31 PM)gimpygirl Wrote: Code: pdb.gimp_image_select_color(image, CHANNEL_OP_REPLACE, tdrawable, (255,0,0)) is correct, and it puts in the selection all the pixels that match red. But that doesn't update the foreground color... (if you use the By-color selection "manually" in the UI, it doesn't update the foreground color either). What you should see instead are the marching ants around the red areas. [attachment=11346]
RE: small plugin code help - gimpygirl - 03-02-2024 But this function is tje same as "select by color" tool in gimp, right? Because that is what i want. |