04-01-2022, 08:37 PM
Some remarks:
- Saving all images in sight isn't a very sound idea. You don't know what other unrelated images the user may have opened, and there could even be images created by scripts and not visible because not associated with a Display.
- If your script runs on all images it doesn't need a PF_IMAGE parameter
- The undo_group_start/undo_group_end isn't useful since it only applies to the initial image. If you want this you have to do it on subimage inside of the loop
- By contrast the gimp_context... calls applies to the "context" which is image-independent, so you can do this outside of the loop
- To properly restore the opacity, bracket the code with gimp_context_push/gimp_context_pop
- On the other hand I don't see where the opacity applies, it is typically used for Paint tools