(define (animation-from-spritesheet frames origImage drawable) (let* ( ; Define local variables (origWidth (car (gimp-image-width origImage) ) ) (origHeight (car (gimp-image-height origImage) ) ) (newWidth (/ origWidth frames ) ) (animImage (car (gimp-image-new newWidth origHeight RGB) ) ) (i 0) ) (gimp-display-new animImage) (while (< i frames ) (let* ( ; Create the new layer (newLayer (car (gimp-layer-new animImage newWidth origHeight RGBA-IMAGE (string-append "Frame " (number->string (+ i 1)) ) 100 NORMAL ) ) ) (sel-float) ) (gimp-image-add-layer animImage newLayer 0) ; Copy the frame from the original source to the new layer (gimp-rect-select origImage (* i newWidth) 0 newWidth origHeight REPLACE 0 0) (gimp-edit-copy drawable) (set! sel-float (car ( gimp-edit-paste newLayer TRUE) ) ) (gimp-floating-sel-anchor sel-float) ; Increment frame count (set! i (+ i 1) ) ) ) ) ) (script-fu-register "animation-from-spritesheet" ; Function name "/Filte_rs/An_imation/From Spritesheet..." ; Menu label "Creates a new image from current image of \ spritesheet, with each sprite on a different \ layer" ; Description "Steven Wallace" ; Author "(c) Copyright 2011 Steven Wallace" ; Copyright "2011-01-06" ; Date "INDEXED* RGB* GRAY*" ; Image types this script works on SF-VALUE "Frames" "0" SF-IMAGE "Image to use" 0 SF-DRAWABLE "Layer to use" 0 )