Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Resize all layers in script-fu
#7
(10-25-2022, 07:19 AM)programmer_ceds Wrote:
(10-24-2022, 09:59 PM)BaconWizard17 Wrote: I am more familiar with Python coding than I am with Scheme, but I've gotten this far with Scheme so I may as well finish the job. I'm assuming that using gimp-image-get-layers would just be: 
Code:
(let*
   (
       (num-layers (car (gimp-image-get-layers image)))
       (layer-ids (cdr (gimp-image-get-layers image)))
   )
        
)

(I haven't done anything with multiple return values before, but from some quick googling this seems to be the right way to do that)

I haven't been able to find terrific documentation on looping in Scheme. Based on what I've seen, I was able to put this together, but it doesn't resize any layers
Code:
(define layer-resize
   (lambda (a-layer layer-ids)
       (gimp-layer-resize-to-image-size a-layer)
   )
)

Any insight?
You could try something like:

Code:
 (set! x 0)
 (while (< x num_layers)
   (gimp-layer-resize-to-image-size (aref layer_ids x))
   (set! x (+ x 1))
 )    ; end - while

This got me on the right path (though I had to use "define" instead of "set!" in the first line), but it seems that it doesn't like how I'm assigning the "num_layers" and "layer_ids" variables. That makes me assume my syntax is incorrect there. I haven't been able to find anything that uses gimp-image-get-layers, so I can't find how I'm supposed to actually get the values.
Modder/Skinner at MarvelMods.com using GIMP to create, edit, and export textures and previews more efficiently.

My GIMP scripts hosted on GitHub
Reply


Messages In This Thread
Resize all layers in script-fu - by BaconWizard17 - 10-23-2022, 04:08 PM
RE: Resize all layers in script-fu - by Ofnuts - 10-23-2022, 07:17 PM
RE: Resize all layers in script-fu - by BaconWizard17 - 10-26-2022, 09:11 PM
RE: Resize all layers in script-fu - by teapot - 10-26-2022, 11:00 PM
RE: Resize all layers in script-fu - by teapot - 10-26-2022, 11:46 PM

Forum Jump: