Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to find or use script I created
#1
I developed this script:
(define (script-fu-red-rectangle-with-borders)
  (let* (
        (width 640)
        (height 400)
        (rect-width 625)
        (rect-height 385)
        (border-size 19)
        (black-border 5)
        (image (car (gimp-image-new width height RGB)))
        (bg-layer (car (gimp-layer-new image width height RGBA-IMAGE "Background" 100 NORMAL)))
        (rect-layer (car (gimp-layer-new image width height RGBA-IMAGE "Red Rectangle" 100 NORMAL)))
        (border-layer (car (gimp-layer-new image width height RGBA-IMAGE "White Border" 100 NORMAL)))
        (black-border-layer (car (gimp-layer-new image width height RGBA-IMAGE "Black Border" 100 NORMAL)))
        )

    ;; Add layers to image
    (gimp-image-insert-layer image bg-layer 0 -1)
    (gimp-image-insert-layer image rect-layer 0 -1)
    (gimp-image-insert-layer image border-layer 0 -1)
    (gimp-image-insert-layer image black-border-layer 0 -1)

    ;; Set transparency background
    (gimp-context-set-background '(0 0 0 0))
    (gimp-drawable-fill bg-layer TRANSPARENT-FILL)

    ;; Select centered rectangle
    (gimp-rect-select image
                      (/ (- width rect-width) 2)  ;; X Position
                      (/ (- height rect-height) 2) ;; Y Position
                      rect-width rect-height
                      REPLACE)

    ;; Fill rectangle with mesh pattern
    (gimp-context-set-pattern "Mesh") ;; Ensure GIMP has a mesh pattern
    (gimp-edit-bucket-fill rect-layer PATTERN-FILL NORMAL 100 0 FALSE 0 0)

    ;; Stroke red border
    (gimp-context-set-foreground '(255 0 0))  ;; Set color to red
    (gimp-edit-stroke rect-layer)

    ;; Expand selection for white border
    (gimp-selection-border image border-size)

    ;; Fill border with white
    (gimp-context-set-foreground '(255 255 255))  ;; White color
    (gimp-edit-bucket-fill border-layer FG-BUCKET-FILL NORMAL 100 0 FALSE 0 0)

    ;; Deselect
    (gimp-selection-none image)

    ;; Select entire canvas for black border
    (gimp-selection-all image)

    ;; Stroke black border
    (gimp-context-set-foreground '(0 0 0))  ;; Black color
    (gimp-edit-stroke black-border-layer)

    ;; Display image
    (gimp-display-new image)
    (gimp-image-undo-group-end image)
  ))

;; Register the script in GIMP
(script-fu-register
  "script-fu-red-rectangle-with-borders"   ;; Internal script name
  "Red Rectangle with Borders"             ;; Menu name (what you see in GIMP)
  "Creates a red rectangle with a mesh pattern and white/black borders"
  "Your Name"
  "Your Name"
  "2025"
  "*"
  ""
  "script-fu-red-rectangle-with-borders")  ;; Function to execute
  and have tried several ways to use it. 
  
  First I saved it in:
  C:\Users\username\AppData\Roaming\GIMP\2.10\scripts\red-rectangle-with-borders.scm
  I tried filters -> Script-FU -> Refresh Script and clicked on filters -> Script-FU and the file wasn't there.  I closed Gimp and reopened it. 
  Then I I looked in help -> Plug-in browser and couldn't find it there. 
  I looked in all of the menus since I read that the scm file could be anywhere but no luck.
  
  So I saved it in downloads and  moved it to this path: 
C:\Program Files\GIMP 2\share\gimp\2.0\scripts\red-rectangle-with-borders.scm  
 I did the same things that I did when I saved it in the roaming folder and still no luck.

Would someone be gracious enough to show me what I did wrong?  Thanks
Reply


Messages In This Thread
Unable to find or use script I created - by Desicub99 - Yesterday, 10:18 PM

Forum Jump: