Help with Image stacking - 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: Help with Image stacking (/Thread-Help-with-Image-stacking) |
Help with Image stacking - csoulman - 07-18-2019 I've been using GIMP for a long time and have some familiarity using BIMP but I recently came across something I need to automate that it can't without scripting or a plugin. I would like to start with an image with a white background and stack multiple PNG images on top of each other. For what I need, it will just be the same image stacked on top of itself a variable number of times. Basically like this: ---- Start with a new, square dimension image. Take a PNG file with a transparent background Put the first image near the top left corner Then place another copy a few pixels down and to the right (variable pixels and number of times). ---- Something tells me this can be done with a script or plugin. I do have some programming experience and I'm learning Python now, but if a method, plugin, or script exists I would be able to use I would appreciate being steered in the right direction. Any help you can give me would be greatly appreciated! RE: Help with Image stacking - Ofnuts - 07-18-2019 You just need to set the offsets of the layers, for instance, to stack the layers in a diagonal: Code: for i,l in enumerate(image.layers): Plenty of example Python plugins here. If any questions about them, just ask below. RE: Help with Image stacking - tmanni - 07-18-2019 A non-optimized way to do it : Code: #!/usr/bin/env python Save the above code in a file in the appropriate place (sorry, I'm linux addict, I don't know where windows user must save their plug-ins) Ensure the file has execution rights. Run GIMP : you will have a menu called 'csoulman' with one entry : 'the plug-in name' To improve it : - load the image only once, then use layer.copy() - check pdb.gimp_file_load_layer success |