; ==================================== ; Gimp script : Ganimate MRH 17 Apr 99 ; ==================================== ; ; ============================================================== ; ; Composites a series of files into an animated gif. ; Prompts for base filename, and extension, then ; inserts counter between them to find other files. ; ; ============================================================== (define (ganimate basefile basetype finalname time startimage nimages) ; create first filename ; --------------------- (set! filenum (number->string startimage 10)) (set! firstfile (string-append (string-append basefile filenum) basetype)) (set! image (car (gimp-file-load 1 firstfile firstfile) ) ) ; create the first image ; ---------------------- (gimp-display-new image) (gimp-image-set-filename image finalname) ; get information about it (or make it up) ; ---------------------------------------- (set! drawable (car (gimp-image-active-drawable image))) (set! width (car (gimp-image-width image))) (set! height (car (gimp-image-height image))) (set! type (car (gimp-drawable-type image drawable))) (set! opacity 100.0) (set! combine 0) ; Now make new layers and read in other files ; ------------------------------------------- (set! stime (number->string time 10)) (set! count startimage) (while (< count nimages) (set! count (+ 1 count)) ; create filenames ; ---------------- (set! filenum (number->string count 10)) (set! layer_name (string-append (string-append (string-append (string-append "Layer" filenum) " (") stime) "ms) (replace)")) (set! file (string-append (string-append basefile filenum) basetype)) ; create layers ; ------------- (set! layer (car(gimp-layer-new image width height type layer_name opacity combine))) (gimp-image-add-layer image layer 0) (gimp-image-set-active-layer image layer) (set! drawable (car (gimp-image-active-drawable image))) (set! newimage (car (gimp-file-load 1 file file) ) ) ;; (gimp-display-new newimage) ; debug ; copy new image and paste into original ; -------------------------------------- (set! newdrawable (car (gimp-image-active-drawable newimage))) (gimp-edit-copy newimage newdrawable) (set! float (car (gimp-edit-paste image drawable 0))) (gimp-floating-sel-anchor float) ) ; make sure image is indexed, and write out ; ----------------------------------------- (gimp-convert-indexed image 1 256) (file-gif-save 0 image drawable finalname finalname 1 1 100 2) ) (script-fu-register "ganimate" "/Xtns/MRH/ganimate" "Make an animated gif" "Mark Harris (markh@xray.bmc.uu.se)" "Mark Harris" "17 Apr 99" "" SF-VALUE "Base Filename : " "\"mtmp\"" SF-VALUE "Filetype : " "\".tga\"" SF-VALUE "Final name : " "\"movie.gif\"" SF-VALUE "Time between frames : " "100" SF-VALUE "Starting image : " "1" SF-VALUE "Final image : " "20" )