Hi,

I've attached a script which merges a list of pictures to an animation.
Maybe it's not exactly what you want, but it could be a good starting point.
I've wrote this script for Gimp 1.0.4.

Regards
Gerd

-- 
________________________________________________________________
Gerd Mueller                               [EMAIL PROTECTED]
softwarebuero m&b                    http://www.softwarebuero.de

; Converts an list of images to eps
(define (add-picture mainImage inFile outFile)

    ; open the frame picture and copy it
    (set! theImage (car (gimp-file-load 1 inFile inFile)))
    (set! theDrawable (car (gimp-image-active-drawable theImage)))
    (set! width (car (gimp-image-width theImage)))
    (set! height (car (gimp-image-height theImage)))
    (gimp-selection-all theImage)
    (gimp-edit-copy theImage theDrawable)
    (gimp-image-delete theImage)

    ; add a new layer to the main picture
    (set! theLayer (car (gimp-layer-new mainImage width height 0 inFile 0 0)))
    (gimp-image-add-layer mainImage theLayer 0)
    (gimp-image-set-active-layer mainImage theLayer)
    (gimp-layer-set-opacity theLayer 100)
    (gimp-layer-add-alpha theLayer)

    ; copy the frame into it
    (set! theMainDrawable (car (gimp-image-active-drawable mainImage)))
    (set! theFloatingSel (car (gimp-edit-paste mainImage theLayer 0)))
    (gimp-floating-sel-anchor theFloatingSel)

    ; clear the background
    (set! theColor (car (gimp-color-picker mainImage theLayer 1 1 0 1)))
    (gimp-by-color-select mainImage theLayer theColor 0 2 1 2 2 0)
    (gimp-edit-clear mainImage theLayer)

    (set! theBgLayer (car (gimp-layer-new mainImage width height 0 inFile 0 0)))
    (gimp-image-add-layer mainImage theBgLayer 0)
    (gimp-image-set-active-layer mainImage theBgLayer)
    (gimp-layer-set-opacity theBgLayer 100)
    (gimp-layer-add-alpha theBgLayer)
    (gimp-selection-all mainImage)
    (gimp-bucket-fill mainImage theBgLayer 0 0 100 255 0 1 1)
    
    ; shadow layer
    (gimp-palette-set-default-colors)
    (set! theShadowLayer (car (gimp-layer-copy theLayer 1)))
    (gimp-layer-set-preserve-trans theShadowLayer 1)
    (gimp-image-add-layer mainImage theShadowLayer 0)
    (gimp-image-set-active-layer mainImage theShadowLayer)
    (gimp-layer-set-opacity theShadowLayer 65)
    (gimp-selection-all mainImage)
    (gimp-bucket-fill mainImage theShadowLayer 0 0 100 255 0 1 1)
    
    ; smooth shadow
    (gimp-layer-set-preserve-trans theShadowLayer 0)
    (plug-in-gauss-iir 1 mainImage theShadowLayer 10 1 1)
    (set! theFloatingSel (car (gimp-selection-float mainImage theShadowLayer 8 8)))
    (gimp-floating-sel-anchor theFloatingSel)
    (gimp-selection-none mainImage)

    (gimp-image-raise-layer mainImage theLayer)
    (gimp-image-raise-layer mainImage theLayer)
    (set! theCompleteLayer (car (gimp-image-merge-visible-layers mainImage 0)))

    ; clear the background
    (set! theColor (car (gimp-color-picker mainImage theCompleteLayer 1 1 0 1)))
    (gimp-by-color-select mainImage theCompleteLayer theColor 0 2 1 2 2 0)
    (gimp-edit-clear mainImage theCompleteLayer)

    ; layer off
    (gimp-layer-set-visible theCompleteLayer 0)
    )

(define (join-pictures-to-anim inList outDir width height)
    (set! mainImage (car (gimp-image-new width height 0)))
    (set! theStream (fopen inList "r"))
    (set! fileContents (fread 10000 theStream))
    (fclose theStream)
    (set! theFiles (strbreakup fileContents "\n"))
    (while theFiles
        (add-picture mainImage (car theFiles) outDir)
        (set! theFiles (cdr theFiles))
        )
    (gimp-image-scale mainImage 150 112)
    (gimp-convert-indexed mainImage 1 15)
    (set! theMainDrawable (car (gimp-image-active-drawable mainImage)))
    (file-gif-save 1 mainImage theMainDrawable "anim.gif" "anim.gif" 1 1 100 2)
    ;(gimp-xcf-save 0 mainImage theMainDrawable "anim.xcf.gz" "anim.xcf.gz")
    (plug-in-animationplay 1 mainImage theMainDrawable)
    )

(script-fu-register
    "join-pictures-to-anim"
    "<Toolbox>/Xtns/Script-Fu/Misc/Join pictures to anim"
    "Creates a pattern from a picture"
    "Gerd Mueller"
    "(C) '99 by softwarebuero m&b"
    "September 03, 1999"
    ""
    SF-VALUE "In List: "    "\"pic.lst\""
    SF-VALUE "Out Dir: "    "\".\""
    SF-VALUE "Width: "      "160"
    SF-VALUE "Height: "     "120"
    )
    

Reply via email to