Need help with small edit to a plug-in - 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) +--- Thread: Need help with small edit to a plug-in (/Thread-Need-help-with-small-edit-to-a-plug-in) |
Need help with small edit to a plug-in - Fizzgig - 03-22-2022 Hello! I do a lot of image work for my job and my little team really appreciates all the time and effort you all put into these plug-ins. Countless hours have been saved thanks to the work you all share and upload. I was hoping I could find someone who could help write a small QOL edit a plug-in. The plug-in is the Center Resize All Layers to Image Size created by Tin Tran over on http://gimplearn.net. Would it be possible to have the code loop until it's Centered/Resized all layers and then delete the "Background" layer? First I need to say: None of my team, myself included, is very good with GIMP. I'd still classify us all as novice, even after years. Some of them can barely understand what a "brush" or "layer" is and just follow a very basic step-by-step-with-pictures guide to get their basic edits done. I swear they're smart. Just... not with image work/programs. We work with hundreds of images at a time. For the scaling/size, we typically open a new canvas with our desired size/dimensions, upload a ton of different sized images as layers, use that plug-in to center and resize all of the images to the canvas size, and then use another plug-in to export all layers as individual images. We export to a lot of different folders. Unfortunately, this means they also export the white Background layer to every folder as well. They will then go to every individual folder (sometimes a couple hundred) and delete the white background image. It would be so much less of a headache to just have that layer deleted automatically before exporting. Code: #!/usr/bin/env python RE: Need help with small edit to a plug-in - PixLab - 03-23-2022 Why not removing/deleting the background before exporting? If it to resize and center a millions image's canvas, XnConvert is your friend and will go way faster than GIMP IMHO, drop your folders in XnConvert, setup your filters, output directories, and so... for an old slow computer like mine, it does > 5-600 images conversion per minute depending size, filters added... and so (03-22-2022, 09:18 PM)Fizzgig Wrote: They will then go to every individual folder (sometimes a couple hundred) and delete the white background image. I don't know if one will do the change in your python plugin, but you can do the removal of all the background via your operating system terminal as you are dealing with directories (folders). It will be done in less than a second by your OS. Depending your directories set-up/trees and if name you give to the "background.jpg" is the same across all your directories (or has the same naming pattern). On Linux I would go in the root directory of your saved work via terminal then run in the terminal something like this (That's just an example, and most important, I would some test on a dummy directory with sub-directories to be sure or fine tune it) Code: find . -name "background.jpg" -type f -delete which basically will delete recursively all files named "background.jpg" in the directory you are in, as well as in all sub-directories. For windows, I have no idea what the code will be, just wait, there are windows users here as well, or maybe some one will add the removal background line to your code. RE: Need help with small edit to a plug-in - nelo - 03-23-2022 Quote:Would it be possible to have the code loop until it's Centered/Resized all layers and then delete the "Background" layer? Why not ask Tin Tran himself over at gimp-learn? He wrote the plug-in, he knows best what it's about and how to extend it. And he's a helping guy. RE: Need help with small edit to a plug-in - Fizzgig - 03-23-2022 @PixLab Trying to install new software on our work PCs is a nightmare and a months long ordeal. If it's not deemed important enough by the IT department, it's a backlog issue that may honestly never actually get done. I'm not sure most of my team knows enough about Windows to be able to reliably use the command prompt. They're good with Microsoft Office things and especially Excel, but we have a few stubborn older people who have a hard time learning new things on the PC. As you can imagine, converting to remote work was a rough time. They already know how to use these plug-ins for GIMP, it'd be easier (and less of a headache for me to explain) to just add it to something they already do. But you raised a good point, I realize it would probably be easier to ask the author if it's possible to edit the export plug-in rather than edit in a loop/delete layer in this one. @nelo That's fair, I'll try to contact him. I assumed it'd be a simple edit and I would get a quicker response here. But I don't know much about programming, so my assumption just made an ass out of me. |