You cannot have a GUI interaction in a script. Typically you would ask the user to define the rectangle before calling your script.
If you have to process many pictures in sequence, you can do this:
If you have to process many pictures in sequence, you can do this:
- load the first image and do the initial processing
- let the user define the square
- run a second script that:
- does the second part of the process
- saves/exports the image
- loads the next image and does the initial processing
- does the second part of the process
- go to step 2