Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scale image relative size?
#8
(08-26-2022, 07:14 PM)Ofnuts Wrote:
(08-26-2022, 06:00 PM)BaconWizard17 Wrote:
(08-25-2022, 07:47 AM)Kevin Wrote: You need to know that most GIMP functions in script-fu return a list, not a single value, so you need to extract the first value from the list:

Code:
(newWidth (car (gimp-image-width image)))
(newHeight (car (gimp-image-height image)))

That makes sense. Unfortunately, I'm still getting the same error with this:
Code:
(define (script-fu-scale-half image)
    (gimp-image-undo-group-start image)
    (gimp-selection-none image)
    (let*
        (
            (newWidth (car (gimp-image-width image)))
            (newHeight (car (gimp-image-height image)))
        )
        (gimp-image-scale image (/ newWidth 2) (/ newHeight 2))
    )
    (gimp-displays-flush)
    (gimp-image-undo-group-end image)
)

Edit: I wish I knew why, but it inexplicably started working without me changing anything (as far as I can tell). It works now!

Did you refresh the script (or restart Gimp)?
I thought I had (filters>script-fu>refresh scripts), but maybe I had missed it.
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
Scale image relative size? - by BaconWizard17 - 08-14-2022, 02:46 PM
RE: Scale image relative size? - by Ofnuts - 08-14-2022, 03:15 PM
RE: Scale image relative size? - by BaconWizard17 - 08-25-2022, 12:15 AM
RE: Scale image relative size? - by rich2005 - 08-14-2022, 03:55 PM
RE: Scale image relative size? - by Kevin - 08-25-2022, 07:47 AM
RE: Scale image relative size? - by BaconWizard17 - 08-26-2022, 06:00 PM
RE: Scale image relative size? - by Ofnuts - 08-26-2022, 07:14 PM
RE: Scale image relative size? - by BaconWizard17 - 08-27-2022, 07:08 PM

Forum Jump: