Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scale image relative size?
#4
(08-14-2022, 03:15 PM)Ofnuts Wrote: See (gimp-image-width image) and (gimp-image-height image) to get the image width and height. Getting the sizes of layers is pointless here because you'll be scaling the image and not the layers.

The best way to find an answer to this kind of questions if to start the Scrip-fu console (Filters ➤ Script-fu ➤ Console) and then hit the Browse... button and try the terms in the search bar at the top left:

I've been trying to use these commands in the following script:

(gimp-image-scale image (/ (gimp-image-width image) 2) (/ (gimp-image-height image) 2))

But I keep getting an error that "argument 1 must be a number" for the division operations. Do I need to be assigning the value to a variable somehow?

Edit: managed to figure out how to assign variables and got this far, but now Gimp crashes when I use this:

(gimp-image-undo-group-start image)
(gimp-selection-none image)
(let*
(
(newWidth (gimp-image-width image))
(newHeight (gimp-image-height image))
)
(gimp-image-scale image (/ newWidth 2) (/ newHeight 2))
)
(gimp-displays-flush)
(gimp-image-undo-group-end image)
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: