I had been using a script that worked fine in gimp 2.4, but when I tried to 
recently use this script in Windows 2.6.3 I got the following error:

http://my.opera.com/capnhud/albums/showpic.dml?album=309313&picture=8928433


The script that I was using is this:


; Script to create a gradient from an image of a gradient
; Rob Antonishen

(define (script-fu-gradient-from-image img inLayer inSegments inSmooth inName)
  (let* 
    (
          (img (car (gimp-image-duplicate img)))  ;create a duplicate
          (width (car (gimp-image-width img)))
          (height (car (gimp-image-height img)))
          (segments (truncate inSegments))
          (colors (+ segments (if (= inSmooth TRUE) 1 0)))
          (theGradient "")
          (counter 0)
        )
        
        ; it begins here
        (gimp-image-undo-group-start img)

        ;flatten inage and get drawable (layer)
        (set! inLayer (car (gimp-image-merge-visible-layers img 1)))
        
        ; blur then resize to number of colors  by 1
    (gimp-image-scale img colors 1)
        
    ;create new gradient
        (set! theGradient (car (gimp-gradient-new inName)))
        (gimp-context-set-gradient theGradient)
        
        ;subdivide
        (gimp-gradient-segment-range-split-uniform theGradient 0 0 segments)

        (while (< counter segments)     
            (gimp-gradient-segment-set-left-color theGradient counter (car 
(gimp-image-pick-color img inLayer counter 0 FALSE FALSE 0)) 100)
            (gimp-gradient-segment-set-right-color theGradient counter (car 
(gimp-image-pick-color img inLayer (+ counter (if (= inSmooth TRUE) 1 0)) 0 
FALSE FALSE 0)) 100)
                (set! counter (+ counter 1))
        )
        
        ;done
        (gimp-image-undo-group-end img)
        (gimp-image-delete img)
  )
)

(script-fu-register "script-fu-gradient-from-image"
                            "<Image>/Colors/Gradient from Image..."
                    "Dreate a gradient from an image of a gradient."
                    "Rob Antonishen"
                    "Rob Antonishen"
                    "2008"
                    ""
                    SF-IMAGE      "image"      0
                    SF-DRAWABLE   "drawable"   0
                    SF-ADJUSTMENT "Segments in the gradient" (list 25 2 1024 1 
10 0 SF-SLIDER)
                                    SF-TOGGLE     "Smooth Gradient" TRUE
                    SF-STRING     "Gradient Name"  "Gradient From Image"        
        



what is the correct type for argument 3?


      
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Reply via email to