Gimp-Forum.net
Is there a way to automate file exports to make anim frames? - 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: Is there a way to automate file exports to make anim frames? (/Thread-Is-there-a-way-to-automate-file-exports-to-make-anim-frames)



Is there a way to automate file exports to make anim frames? - rgbellotti - 08-14-2020

Rather than creating multiple layers within GIMP to build animations with, I would like to be able to export multiple images with a naming system like sample_001.jpg, sample_002.jpg, sample_003.jpg etc.  The idea being, that each one will be the same image with the same filter applied, but each export will slightly modify one (or more) of the filters attributes.  For example, started with a normal image, and then on each export, applying a blur filter so that the first image is crystal clear, and the last image is max blur.  To do this manually, I can apply the blur filter -> export -> undo blur -> re-apply blur with a more intense setting -> export -> undo blur -> and so on.  Eventually having a folder of images with a "gradient" of blur applied to them collectively, which I can then import into a video editor to chain together.

I'm thinking I can use python for this, but haven't been able to find an example showing how that would be possible

I'm new to python-fu (and scheme, but I know python so I was hoping I could use it instead of scheme). Anyways, I was thinking it could have something to do with the process of selecting the "pdb.file_jpeg_save" plugin in the python-fu console, and creating a for loop or while loop so that I can save a file in each iteration using the string filename = "image" + increment_variable, and then also applying a filter and incrementing or decrementing a filter parameter too.

Are there any good tutorials that cover these types of specifics? Thanks in advance!


RE: Is there a way to automate file exports to make anim frames? - Ofnuts - 08-14-2020

What you want to do is quite simple and is a good project to start scripting.

I haven't not seen any good tutorials on Python scripting yet...

There is a (slightly incomplete) doc here: https://www.gimp.org/docs/python/index.html . This coupled with the reading of existing code will get you started.

Speaking of existing code, I have written a few Python Gimp scripts over time, see here: http://sourceforge.net/projects/gimp-tools/files/scripts/ My style evolved over time, the more recent scripts are likely better examples, but can also be a bit more complex. Feel free to borrow/steal code or ideas. The one closest to what you want to do is perhaps ofn-rotate-layer, it shows you how to copy the source layer and do some editing (in that case it rotates it). It also shows you how you feed parameters to a script.

To debug you scripts, some hints here: https://www.gimp-forum.net/Thread-Debugging-python-fu-scripts-in-Windows

Don't hesitate to ask more questions...


RE: Is there a way to automate file exports to make anim frames? - rgbellotti - 08-16-2020

Ah perfect! Thank you that's what I was hoping for I'm sure it'll keep me busy for a moment but glad knowledgeable communities like this exist Smile