Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Resize all layers in script-fu
#9
(10-26-2022, 11:00 PM)teapot Wrote:
(10-26-2022, 09:11 PM)BaconWizard17 Wrote: 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.

You are using cdr to get the layer ids, use cadr. Here's my go:

Code:
 ; Testing resize layers to image size
  (let ((num-layers (car (gimp-image-get-layers image)))
       (layer-ids (cadr (gimp-image-get-layers image)))
       (i 0))
    (while (< i num-layers)
      (gimp-layer-resize-to-image-size (vector-ref layer-ids i))
      (set! i (+ i 1))))

That worked perfectly! Thank you for the help! 

I noticed you used "let" instead of "let*". Both variations work for me, but is there a difference between the two?
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 teapot - 10-26-2022, 11:00 PM
RE: Resize all layers in script-fu - by BaconWizard17 - 10-26-2022, 11:23 PM
RE: Resize all layers in script-fu - by teapot - 10-26-2022, 11:46 PM

Forum Jump: