Gimp-Forum.net
GIMP Script-fu/Python-fu: apply filter or color to all layers? - 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: GIMP Script-fu/Python-fu: apply filter or color to all layers? (/Thread-GIMP-Script-fu-Python-fu-apply-filter-or-color-to-all-layers)



GIMP Script-fu/Python-fu: apply filter or color to all layers? - gerescripts - 06-14-2018

Okay, I'm fairly new to GIMP scripts/plug-ins and gimp-forum so I apologize in advance for any blunders I'm prone to make.

Anyway, I have Windows 8, GIMP 2.8.22, GAP, and animstacks all for the purpose of making high quality gifs. Recently I noticed GAP Frame Scale (plug-in-gap-anim-scale or ANIM_SCALE) resizes every frame/layer in a single file, and I'm curious; using GAP's defined parameters or similar code, is it possible to automate other plug-ins to transform every layer? For instance, a script or plug-in for unsharp mask or levels that applies to each layer in the file.

If it's been done before or there's a simpler method of achieving my goal (applying filters and colors to every frame of a gif) then please let me know! I barely know how to read code, but to me it appears achievable to combine GAP's .xcf animation function with filter or color scripts.

P.S. You're welcome to answer my question on stackoverflow.


RE: GIMP Script-fu/Python-fu: apply filter or color to all layers? - Ofnuts - 06-14-2018

Yes and no...
  • In the general case, yes, there are few things(*) that you cannot do to a layer with a script, so it could be a Small Matter Of Programming to iterate the process over the layers.
  • For many plugins, it is often quite simple since the plugin API takes the same parameters as the plugin GUI (thoe where the GUI is auto-generated from the API)
  • But there are plugins that have a different set of parameters
  • And there are tools where the API is very different from the GUI, when it exists at all (freehand selection, quick mask..)
  • And you have to consider a mix of the above...
  • And all the above assumes that you write a dedicated script for each target processing.
  • There may be ways using to write a sufficiently general code that could take a simple plugin (second item above), discover the parameters, ask the user for parameters, and iterate it, but if you want to use two scripts in sequence you will have to manage all the parameters of all the scripts, when in practice parameters of the scripts are often interrelated.
So, all in all, a lot of effort for not that much value (unless I am missing something...).

A completely different way of solving the problem is to transform the image frames into a tile sheet, process the sheet manually wit the full power of the GUI, and then split the tile sheet into frames when done (assuming this produces an image of manageable size).

(*) but these exist...

PS: also answered on StackOverflow