RSS/Atom feed Twitter
Site is read-only, email is disabled

help updating old script please

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

help updating old script please dwood 08 Mar 01:21
  help updating old script please Kevin Cozens 08 Mar 04:53
   help updating old script please dwood 08 Mar 15:16
2009-03-08 01:21:43 UTC (almost 16 years ago)
postings
2

help updating old script please

I found the following script:

"

;; tile2anim.scm -*-scheme-*- ;; Converts a tiled animation to a layered animation ;; A tiled animation is one where each frame of the animation ;; is tiled across the image horizontally. For example, ;; a 48x48 30 frame animation would be an image with the ;; size 1440x48. Frame 1 is at (0,0)-(47,47), 2 at (48,0)-(95,47) ;; and so on
;;
;; Version 1.2
;;
;; Copyright (C) 2007 by Brian Vanderburg II ;;
;;
;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License ;; as published by the Free Software Foundation; either version 2 ;; of the License, or (at your option) any later version. ;;
;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;;
;; You should have received a copy of the GNU General Public License ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Internal function to create the layered animation (define (script-fu-tile2anim img drw frameWidth frameHeight frameCount frameDirection)

(let*
(
(theWidth)
(theHeight)
(theCols)
(theRows)
(theCol)
(theRow)
(theImage)
(theLayer)
(framePos)
(tmpLayer)
)

; get image information
(set! theWidth (car (gimp-image-width img))) (set! theHeight (car (gimp-image-height img)))

; create new image and layer (set! theImage (car (gimp-image-new theWidth theHeight RGB))) (set! theLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "TMP" 100 NORMAL-MODE)))

(gimp-image-add-layer theImage theLayer 0) (gimp-drawable-fill theLayer TRANSPARENT-FILL)

; copy visible portion of image (gimp-selection-none img)

(if (= (car (gimp-edit-copy-visible img)) TRUE) (begin
(gimp-rect-select theImage 0 0 theWidth theHeight CHANNEL-OP-REPLACE 0 0) (gimp-floating-sel-anchor (car (gimp-edit-paste theLayer FALSE))) )
)

; frame width
(if (= frameWidth 0) (set! frameWidth theWidth) )

; frame height (if (= frameHeight 0) (set! frameHeight theHeight) )

; number of columns and rows (set! theCols (floor (/ theWidth frameWidth)) ) (set! theRows (floor (/ theHeight frameHeight)) )

; number of frames (if (= frameCount 0)
(set! frameCount (* theCols theRows)) (if (> frameCount (* theCols theRows)) (set! frameCount (* theCols theRows)))
)

; process frames
(set! framePos 0)
(set! theCol 0)
(set! theRow 0)

(while (< framePos frameCount)

; create new layer and add it to image (set! tmpLayer (car (gimp-layer-new theImage frameWidth frameHeight RGBA-IMAGE "Layer" 100 NORMAL-MODE))) (gimp-image-add-layer theImage tmpLayer -1) (gimp-drawable-fill tmpLayer TRANSPARENT-FILL)

; copy (gimp-rect-select theImage (* theCol frameWidth) (* theRow frameHeight) frameWidth frameHeight CHANNEL-OP-REPLACE 0 0)

(if (= (car (gimp-edit-copy theLayer)) TRUE) (begin
(gimp-rect-select theImage 0 0 frameWidth theHeight CHANNEL-OP-REPLACE 0 0) (gimp-floating-sel-anchor (car (gimp-edit-paste tmpLayer FALSE) ) ) )
)

(gimp-selection-none theImage)

; next frame (set! framePos (+ framePos 1))

; direction (0 = left to right first, else top to bottom first) (if (= frameDirection 0)
(begin
(set! theCol (+ theCol 1) )
(if (>= theCol theCols)
(begin
(set! theCol 0)
(set! theRow (+ theRow 1) )
)
)
)
(begin
(set! theRow (+ theRow 1) )
(if (>= theRow theRows)
(begin
(set! theRow 0)
(set! theCol (+ theCol 1) )
)
)
)
)
)

; Remove old layer
(gimp-image-remove-layer theImage theLayer)

; set correct image size (gimp-image-resize theImage frameWidth frameHeight 0 0)

; show image (gimp-display-new theImage)
)

) ; script-fu-tile2anim

(script-fu-register "script-fu-tile2anim" _"_Tiles2Animation..."
_"Converts a tile of frames to a layered animation." "Brian Vanderburg II "
"Brian Vanderburg II"
"August 2007"
"RGB*, INDEXED*, GRAY*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Layer (unused)" 0

SF-ADJUSTMENT _"Frame Width (0 for Image Width)" '(48 0 20000 1 10) SF-ADJUSTMENT _"Frame Height (0 for Image Height)" '(48 0 20000 1 10 0 0) SF-ADJUSTMENT _"Frame Count (0 for Auto)" '(0 0 2000000 1 10 0 0) SF-OPTION _"Direction" '(_"Left to Right" _"Top to Bottom") )

(script-fu-menu-register "script-fu-tile2anim" ; _"/Script-Fu/Animators")
_"/Filters/Animation")

"

And It works up until I ask it to compile the animation.

Can I get it updated so it will work on Gimp 2.6?

Kevin Cozens
2009-03-08 04:53:58 UTC (almost 16 years ago)

help updating old script please

Dason wrote:

I found the following script:
;; tile2anim.scm -*-scheme-*-

[snip]

(let*
(
(theWidth)
(theHeight)
(theCols)
(theRows)
(theCol)
(theRow)
(theImage)
(theLayer)
(framePos)
(tmpLayer)
)

The main problem I see is you are using variables in the binding portion of the let* block but did not provide an initial value for those variables.

See my notes about updating Script-Fu scripts at: http://www.ve3syb.ca/wiki/doku.php?do=show&id=software%3Asf%3Aupdating-scripts

BTW, it is usually better to include a URL to the original script instead of including it in an e-mail when posting to a mailing list. Not too big a deal this time as the script wasn't that long.

2009-03-08 15:16:43 UTC (almost 16 years ago)
postings
2

help updating old script please

Dason wrote:

I found the following script:
;; tile2anim.scm -*-scheme-*-

[snip]

(let*
(
(theWidth)
(theHeight)
(theCols)
(theRows)
(theCol)
(theRow)
(theImage)
(theLayer)
(framePos)
(tmpLayer)
)

The main problem I see is you are using variables in the binding portion of

the let* block but did not provide an initial value for those variables.

See my notes about updating Script-Fu scripts at: http://www.ve3syb.ca/wiki/doku.php?do=show&id=software%3Asf%3Aupdating-scripts

BTW, it is usually better to include a URL to the original script instead of

including it in an e-mail when posting to a mailing list. Not too big a deal

this time as the script wasn't that long.

Okay. I'll remember that next time.

Thanks for the help! Turns out Gimp.org had what I needed too! I just didn't check the changes far enough down!

Now for me to add more functionality... *is lost*