

Have you considered creating a macro in any image editor that supports macros and assigning that to a button / keyboard shortcut?
gimp certainly has macros and scripting features. Maybe this will help: https://www.gimp.org/tutorials/Automate_Editing_in_GIMP/
You can still edit a mask / selection with the regular UI, then trigger the cut/merge process you desire based on that selection.
Most people will run a post 2.6 kernel, so prlimit will be available as an interesting alternative to ulimit.