GIMP Home
How to get GIMP?
I noticed
Addition
Materials
Useful Plugins
Plugin details
script-fu link
Update log
 
Logo1
Logo2
Others1
Others2
Useful script-fu
Useful script-fu2
Useful script-fu3
Useful script-fu4
Syntax of script-fu
Error!!
compare version
 
Gallery
 
 
Home


Syntax of script-fu

About input box
SF-ADJUSTMENT'(default min max step step characters(0 : integer) kind(0 or 1))
SF-ADJUSTMENT 1'(24 2 100 1 10 0 1)
SF-ADJUSTMENT 2'(0.01 0 1 0.01 0.01 2 0)
SF-BRUSH'("Circle (07)" 1.0 20 0)
SF-STRING"3D-FUN!"
SF-FONT"Sans Bold"
SF-IMAGE0
SF-DRAWABLE0
SF-OPTION'("White" "Black" "Pattern" "Gradient")
SF-TOGGLEFALSE
SF-COLOR'(153 153 153)
SF-GRADIENT"Incandescent"
SF-PATTERN"Blue Web"
SF-VALUE"15"
SF-FILENAME(string-append "" gimp-data-dir "/scripts/images/beavis.jpg")


Mode
Layer "layer-copy" mode sets "SCREEN".
(gimp-layer-set-mode layer-copy SCREEN-MODE)
NORMAL-MODE 0
DISSOLVE-MODE 1
BEHIND-MODE 2
MULTIPLY-MODE 3
SCREEN-MODE 4
OVERLAY-MODE 5
DIFFERENCE 6
ADDITION-MODE 7
SUBTRACT-MODE 8
DARKEN-ONLY-MODE 9
LIGHTEN-ONLY-MODE10
HUE-MODE 11
SATURATION-MODE 12
COLOR-MODE 13
VALUE-MODE 14
DIVIDE-MODE 15
DODGE-MODE 16
BURN-MODE 17
HARDLIGHT-MODE 18
SOFTLIGHT-MODE 19
GRAIN-EXTRACT-MODE 20
GRAIN-MERGE-MODE 21
COLOR-ERASE-MODE 12


Changed
  • aset - TinyScheme "vector-set!"
  • aref - TinyScheme "vector-ref"
  • fopen - TinyScheme "open-input-file"
  • mapcar - TinyScheme "map"
  • nil - TinyScheme "'()"
  • nreverse - TinyScheme "reverse"
  • pow - TinyScheme "expt"
  • prin1 - TinyScheme "write"
  • print - TinyScheme "write" (after "newline")
  • strcat - TinyScheme "string-append"
  • string-lessp - TinyScheme "string<?"
  • symbol-bound? - TinyScheme "defined?"
  • the-environment - TinyScheme "current-environment"
  • *pi* - "(* 4 (atan 1.0))"
  • butlast - "(reverse (cdr (reverse x)))"
  • cons-array - TinyScheme "make-vector"

  • FG-IMAGE-FILL - FOREGROUND-FILL
  • gimp-brushes-get-brush - gimp-context-get-brush
  • gimp-palette-get-foreground - gimp-context-get-foreground
  • (set! theBackgroundGradient (gimp-gradient-new "Fond-screenshot-with-style")) -

  • Later GIMP2.0 cant change layer-size etc..before this script-fu, (gimp-image-add-layer img bg-layer 0).


Replace
  • (plug-in-rgb-noise 1 img layer1 FALSE FALSE 1 1 1 0) = (plug-in-noisify 1 img layer1 FALSE 1 1 1 1)
  • (plug-in-gauss 1 img layer1 20 20 0) = (plug-in-gauss-iir 1 img layer1 20 20 0)
  • (gimp-image-resize-to-layers img) = (gimp-image-resize img width height 0 0) etc..


car, cadr, etc
(set! color '(128 253 147))
(car color) = 128
(caddr color) = 147
(cdr color) = (253 147)


Examples
Fill setting Color and restore palette's color.
(let ((old-fg(car (gimp-palette-get-foreground))))
     (gimp-palette-set-foreground Color)
     (gimp-edit-fill layer-copy 0)
     (gimp-selection-none img)
     (gimp-palette-set-foreground old-fg))



Foreground color setting
(gimp-palette-set-foreground tcolor)
(gimp-layer-set-preserve-trans text-layer TRUE)
(gimp-edit-fill text-layer FG-IMAGE-FILL)
(cond((= foption 1)
  (gimp-gradients-set-active grad) ;gradient
  (gimp-layer-set-preserve-trans text-layer TRUE)
  (gimp-blend text-layer CUSTOM NORMAL gmode 100 20 REPEAT-NONE FALSE 0 0 0 0 width height)
  )
  ((= foption 2)
    (gimp-selection-layer-alpha text-layer)
    (gimp-patterns-set-pattern pat)
    (gimp-bucket-fill text-layer PATTERN-BUCKET-FILL NORMAL 100 255 FALSE 0 0)
    (gimp-selection-none img)
    ))



Change image size
(gimp-image-resize img width height xoffset yoffset)
(gimp-layer-resize text-layer width height xoffset yoffset)


blur=size/10 and pic "img"'s "layer" apply gauss-iir2
(let(
    (blur (/ size 10)))
    (plug-in-gauss-iir2 1 img layer blur blur))



Store original pic
"img" is original, "hznimg" keeps original image.
(define (script-fu-scriptfuname img.....)
(set! hznimg (car (gimp-channel-ops-duplicate img)))
(let* (.....
(gimp-image-clean-all hznimg)
(gimp-display-new hznimg)
))


More easily
(define (script-fu-stamp img2 drawable) - change img to img2
(let* ((old-bg-color (car (gimp-palette-get-background)))
(old-fg-color (car (gimp-palette-get-foreground)))
(sizeX (car (gimp-image-width img2))) - change img to img2
(sizeY (car (gimp-image-height img2))) - change img to img2
(img 0)
)
(set! img (car (gimp-channel-ops-duplicate img2)))
(gimp-image-undo-disable img)
:
:
(gimp-image-undo-enable img)
(gimp-display-new img)
))



history
(gimp-undo-push-group-start img)
.........
(gimp-undo-push-group-end img)

Later GIMP2.0
(gimp-image-undo-group-start img)
.........
(gimp-image-undo-group-end img)


history2
(gimp-image-undo-disable img)
.........
(gimp-image-undo-enable img)


GIMP


kikidide@gmail.com