gimpscript-fu

Gimp Script-Fu: Script to create new image won't run unless another image is open


I have a Gimp script that I use to create an image preview. For some reason, the script is grayed out if I don't have any images open, preventing me from selecting it. I can only select it if I already have an image open. This is frustrating, as I'm using this to create a new image, so I want to be able to use it from startup without anything else open. Is that something that can be done?

I did check to make sure that the placement in the toolbar isn't the issue. Even if I set it to be in File>Create, it's still grayed out.

(define (script-fu-mua-xml2-2x2-preview)
    (let*
        (
            ; define our local variables
            ; create a new image:
            (theImageWidth  1086)
            (theImageHeight 2160)
            (theImage
                (car
                    (gimp-image-new
                        theImageWidth
                        theImageHeight
                        RGB
                    )
                )
            )
            ; background layer
            (theLayer
                (car
                    (gimp-layer-new
                        theImage
                        theImageWidth
                        theImageHeight
                        RGBA-IMAGE
                        "Background"
                        100
                        LAYER-MODE-NORMAL
                    )
                )
            )
        ) ;end of our local variables
        ; add the layers
        (gimp-image-add-layer theImage theLayer 0)
        ; add the guides
        (gimp-image-add-hguide theImage 1080)
        (gimp-image-add-vguide theImage 543)
        ; show the new image on the screen
        (gimp-display-new theImage)
    )
)
; populate script registration information
(script-fu-register 
    "script-fu-mua-xml2-2x2-preview"
    "2x2 Skin Preview"
    "Creates an image for a 2x2 grid preview for 4 skins."
    "BaconWizard17"
    "BaconWizard17"
    "September 2021"
    "*"
)
; register the script within gimp menu
(script-fu-menu-register "script-fu-mua-xml2-2x2-preview" "<Image>/Marvel Mods/Skin Previews/Multi Skin Showcase")```

Solution

  • I believe this is because you have defined the image type as "*" in the registration data. Define it to "" (empty string) and you should be OK.