Gimp-Forum.net
Python-fu delete selection - 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: Python-fu delete selection (/Thread-Python-fu-delete-selection)



Python-fu delete selection - cfdirt - 03-27-2018

This is my first project with python-fu.  I have a routine I need to do on hundreds of images, a few times on each image. 

What I need to do is

1. Select a color using pdb.gimp_image_select_color
2. Delete the contents of that selection

This is the equivalent of

1. Using the Select By Color Tool (Shift O)
2. Hitting the delete button on the keyboard


I can create the selection but I am not sure how to delete the contents within the selection. Can someone steer me in the right direction for what I need to do next or point me towards an example?

Many thanks


RE: pythpn-fu delete selection - Ofnuts - 03-28-2018

That's pdb.gimp_edit_clear(layer). In the python console, hit Browse and you have all the doc (granted, that one is well hidden). To make a script that runs on many files, see this (I am the author of the answer, so you can ask here on G-F.n if you have any questions).


RE: pythpn-fu delete selection - cfdirt - 03-28-2018

(03-28-2018, 06:13 AM)Ofnuts Wrote: That's pdb.gimp_edit_clear(layer). In the python console, hit Browse and you have all the doc (granted, that one is well hidden). To make a script that runs on many files, see this (I am the author of the answer, so you can ask here on G-F.n if you have any questions).

PERFECT!!!! Exactly what I needed. I threw in pdb.python_fu_heal_selection() and successfully completed what I needed to do

Thank you so much!