±qscript_fu¤¤¾Ç²ß¼v¹³³B²z§Þ¥©¡G¤ôªi°Êµe

 

scripts¥Ø¿ý¤U¦³¶W¹L100­Ó *.scmÀÉ¡A³o¨Ç¬O¾Ç²ß¼v¹³³B²z§Þ¥©ªº³Ì¦n±Ð§÷¡A¦b¡u¨Ï¥ÎGIMP½s¿è°Êµe¡]¥|¡^¡v³o½g¤å³¹¤¤¤w¸g¦³°Q½×¹L¤ôªi°Êµe¡A¥»¤å©µÄò¸Ó½g¤å³¹¡A­n¬ã¨sSven Neumann©Ò¼gªºwaves-anim.scmµ{¦¡½X¬O¦p¦ó²£¥Í¤ôªiªº°Êµe¡C

Ū¤F¥»¤å§A±N¾Ç·|¦p¦ó¼g¤@­Ó»s§@²³æ°ÊµeªºScript-Fu¡C

¤@¡B°õ¦æScript-Fu

 

ªáªº¤ôªi°Êµe

 

ÀR¤îªºªá

¦h¹Ï¼hªº°Êµe

 

l          ¹ï¤W¹Ï¡A°õ¦æ[image] -> Script_Fu -> Animators ->Waves¨Ï¥Î¹w³]ªº°Ñ¼Æ¡GAmplitude³]10¡BWavelength³]20¡BNumber of Frames³] 6¡A²£¥Í¥ª¹Ï¡C

l          Amplitude»PWavelength¬O®Ú¾Ú¼v¹³ªº¤j¤p¨Ó³]©wªº¡C¤pªºAmplitude¤pªºWavelength¥i²£¥Íº§ªiªº®ÄªG¡C

l          Number of Frames³] 6¨Ï±o¨C­Óµe®Øªº¤ôªi¬Û®t¬°60«×¡]360¡Ò6¡^¡C

 

 

        ¨Ï¥ÎGimp¹Ï§Î¬É­±¨Ó½s¿è¼v¹³ªº¨C­Ó°Ê§@³£¦³¬Û¹ïÀ³ªº¨ç¼Æ¡Agimp-edit-copy¡Bgimp-edit-paste¡Bgimp-edit-cut¹ïÀ³ªº«K¬O³Ì±`¨Ï¥Îªº¼v¹³½Æ»s¡B¼v¹³¶K¤W¡B¼v¹³°Å¤Uµ¥°Ê§@¡C

¥H¤U§Ú­Ì¨Ï¥ÎGimp¹Ï§Î¬É­±¡A¤@¨B¤@¨B§@¨Ó²£¥Í¤ôªi°Êµe¡CÂǥѳo¹Lµ{¨ÓÅé·|µ{¦¡½Xªº·N«ä¡C

 

¤G¡B¨Ï¥ÎGimp¹Ï§Î¬É­±¡A¤@¨B¤@¨B§@

¨C­Ó¨BÆJ©Ò²£¥Íªº¼v¹³µøµ¡»P¹Ï¼h¹ï¸Ü²°

¥H¹Ï§Î¨Ï¥ÎªÌ¤¶­±²£¥Í¤ôªi®ÄªGªº°Êµe¡A»Ý­nªº¨BÆJ¡G

¹ïÀ³¨ìwaves-anim.scmµ{¦¡½X¤¤ªº¨ç¼Æ

 

l          ­º¥ý­n­pºâ­n²£¥Í¦h¤Ö­Ó¹Ï®Øªº°Êµe¡C

l          ­Y¬O6­Ó¹Ï®Ø¡A«h¤ôªiªº¬Û²¾phaseshift¡×360¡Ò6¡×60«×¡C

l          num-frames=6

l          Phaseshift¡×60

l          ¤@¶}©lPhase=0

l          remaining-frames¡×6

flower.jpgªº¼v¹³µøµ¡

 

Background¹Ï¼h

l          gimp-channel-ops-duplicate¨ç¼Æªº¥Øªº¬O½Æ»s¤@­Ó¼v¹³ªº©Ò¦³¹Ï¼h¡B©Ò¦³¦âÀW¡]channels¡^¡A¤Î¬ÛÃöªº©Ò¦³¸ê®Æ¨ì·sªº¼v¹³ª«¥ó¡Agimp-channel-ops-duplicate¨ç¼Æ§Ú¦bGimp¹Ï§Î¬É­±¤W§ä¤£¨ì¹ïÀ³ªº°Ê§@¡C

l          §Úª½±µ¦b­ì¥»flower.jpgªº¼v¹³µøµ¡¾Þ§@¡A°²³]flower.jpg¼v¹³¥u¦³¤@­Ó¦W¬°Backgroundªº¹Ï¼h¡C

46:image (car (gimp-channel-ops-duplicate img)))

47:source-layer (car (gimp-image-get-active-layer image)))

 

½Æ»sBackground¹Ï¼h

l          ¦b¾Þ§@¹Ï¼hªº¹ï¸Ü²°¤¤¡A½Æ»sBackground¹Ï¼h²£¥Í1­Ó·sªº¹Ï¼h¡A±N·sªº¹Ï¼h§ó¦W¬°Frame 2(replace)¡C

56: (while (> remaining-frames 1)

59: (waves-layer (car (gimp-layer-copy source-layer TRUE)))

60: (layer-name (string-append "Frame¡¨

(number->string

(- (+ num-frames 2) remaining-frames) 10)

" (replace)"))

66: (gimp-layer-set-preserve-trans waves-layer FALSE)

67:(gimp-image-add-layer image waves-layer -1)

68:(gimp-layer-set-name waves-layer layer-name)

 

¨Ï¥ÎWavesÂoÃè

l          ¹ïFrame 2(replace)¹Ï¼hªº¼v¹³°õ¦æ[image] -> Filters -> Distorts -> Waves¡AMode³]Smear¡BAmplitude³]10¡BWavelength³]20¡BPhase³] 0¡A²£¥Í¥ª¹Ï¡C

70:(plug-in-waves 1 image waves-layer amplitude phase wavelength 0 FALSE)

­«ÂФW­±¨BÆJ

l          ­«ÂФW­±¨BÆJ¡G# ªí3¡B4¡B5¡B6

l          ½Æ»sBackground¹Ï¼h²£¥Í·s¹Ï¼h¡A¹Ï¼h§ó¦W¬°Frame # (replace)¡A·s¹Ï¼h­n¦b¬J¦³ªº¹Ï¼hªº¤W¤è¡C

l          ¹ïFrame # (replace)¹Ï¼hªº¼v¹³°õ¦æWavesÂoÃè¡APhase³]¡]#¡Ð2¡^¡Ñ-60¡]¬°­t¸¹¡^¡A¨ä¾l°Ñ¼Æ·Ó¡C

79:(set! remaining-frames (- remaining-frames 1))

80:(set! phase (- phase phaseshift))

¦^¨ì

56: (while (> remaining-frames 1)

§PÂ_¬O§_ÁÙ­nÄ~Äò°õ¦æ while °j°é¡A

ªáªº¤ôªi°Êµe

l          ±NBackground¹Ï¼h§ó¦W¬°Frame 1¡C

l          ¹ïFrame 1¹Ï¼hªº¼v¹³°õ¦æWavesÂoÃè¡APhase³]360¡A¨ä¾l°Ñ¼Æ·Ó¡C

l          °õ¦æ[image] -> Filters -> Animation Playback¨Ó¼½©ñ¦h¹Ï¼hªº°Êµe¡C

l          ©Î¦s¦¨Gif°ÊµeÀÉ¡C

·íremaining-frames>1¡Aµ²§ôwhile °j°é¡A

84:(gimp-layer-set-name source-layer "Frame 1")

85:(plug-in-waves 1 image sources-layer amplitude phase wavelength 0 FALSE)

 

 

¤T¡B­ì©lµ{¦¡½X¡G

l          µ{¦¡½Xwaves-anim.scm¤À¤T³¡¥÷

l          1~31¦æ¡Gµù¸Ñ¡Aª©Åv«Å§i¡C

l          32~58¦æ:¡G(define (script-fu-waves-anim   )) ¡A¦b´ú¸Õµ{¦¡ªº¹Lµ{¤¤¡A§Ú±N¥¦§ï¬°script-fu-sphere2

l          59~98¦æ¡G(script-fu-register " script-fu-waves-anim "  )

l          §Ú±N¬A¸¹¹ï»ô¡A¤è«K¬ã¨sµ{¦¡½X¡A¬G¦æ¼Æ»P­ì¥»ªºÀɮפ£¤@¼Ë¡C

 

1:  ; The GIMP -- an image manipulation program

2:  ; Copyright (C) 1995 Spencer Kimball and Peter Mattis

3:  ;

4:  ; This program is free software; you can redistribute it and/or modify

5:  ; it under the terms of the GNU General Public License as published by

6:  ; the Free Software Foundation; either version 2 of the License, or

7:  ; (at your option) any later version. 

8:  ;

9:  ; This program is distributed in the hope that it will be useful,

10: ; but WITHOUT ANY WARRANTY; without even the implied warranty of

11: ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

12: ; GNU General Public License for more details.

13: ;

14: ; You should have received a copy of the GNU General Public License

15: ; along with this program; if not, write to the Free Software

16: ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

17: ;

18: ;

19: ; waves-anim.scm   version 1.01   1997/12/13

20: ;

21: ; CHANGE-LOG:

22: ; 1.00 - initial release

23: ; 1.01 - some code cleanup, no real changes

24: ;

25: ; Copyright (C) 1997 Sven Neumann <sven@gimp.org>

26: ;

27: ;

28: ; Makes a copy of your image and creates an animation of the active layer

29: ; as if a stone was thrown into the image. The animation may be saved with

30: ; the gif-plug-in.

31:

 

32: (define (script-fu-waves-anim img

33:                        drawable

34:                         amplitude

35:                         wavelength

36:                         num-frames

37:                         invert)

38:   (let*

39:        (

40:          (amplitude (max 0 amplitude))

41:          (wavelength (max 0 wavelength))

42:          (num-frames (max 1 num-frames))

43:          (remaining-frames num-frames)

44:          (phase 0)

45:          (phaseshift (/ 360 num-frames))

46:          (image (car (gimp-channel-ops-duplicate img)))

47:          (source-layer (car (gimp-image-get-active-layer image)))

48:        )

49:

50:        (gimp-image-undo-disable image)

51:

52:        (if (= invert TRUE)

53:            (set! phaseshift (- 0 phaseshift))

54:        )

55: 

 

 

 

 

num-frames=6

 

 

 

 

 

 

 

Phase=0

 

Phaseshift¡×60

 

 

 

56:        (while (> remaining-frames 1)

57:            (let*

58:                (

59:                  (waves-layer (car (gimp-layer-copy source-layer TRUE)))

60:                      (layer-name (string-append "Frame "

61:                                    (number->string

62:                                       (- (+ num-frames 2)

63:                                          remaining-frames) 10)

64:                                      " (replace)"))

65:                )

66:                 (gimp-layer-set-preserve-trans waves-layer FALSE)

67:                  (gimp-image-add-layer image waves-layer -1)

68:             (gimp-layer-set-name waves-layer layer-name)

69:

70:                  (plug-in-waves 1

71:                                   image

72:                                   waves-layer

73:                                   amplitude

74:                                   phase

75:                                   wavelength

76:                                   0

77:                                  FALSE)

78:    

79:                   (set! remaining-frames (- remaining-frames 1))

80:                   (set! phase (- phase phaseshift))

81:             )

82:          )

83:

 

 

 

string-append¨ç¼Æ¡G§â¦r¦ê¦ê±µ°_¨Ó¡C

number->string¨ç¼Æ¡G§â¼Æ¦rÅܦr¦ê¡C

 

¤@¶}©lremaining-frames¡×num-frames¡A

¬Gnum-frames¡Ï2¡Ðremaining-frames¡×2

 

³Ì«á¦X¦¨ªº¦r¦ê "Frame 2 (replace)"

84:         (gimp-layer-set-name source-layer "Frame 1")

85:         (plug-in-waves 1

86:                 image

87:                     source-layer

88:                       amplitude

89:                   phase

90:                       wavelength

91:                       0

92:                       FALSE)

93:

94:          (gimp-image-undo-enable image)

95:          (gimp-display-new image)

96:   )

97: )

98:

 

99:  (script-fu-register "script-fu-waves-anim"

100:             _"<Image>/Script-Fu/Animators/Waves..."

101:             "Animate an image like a stone's been thrown into it"

102:             "Sven Neumann <sven@gimp.org>"

103:             "Sven Neumann"

104:             "1997/13/12"

105:             "RGB* GRAY*"

107:             SF-IMAGE "Image" 0

108:             SF-DRAWABLE "Drawable" 0

109:             SF-ADJUSTMENT _"Amplitude"        '(10  1  101 1 10 1 0)

110:              SF-ADJUSTMENT _"Wavelength"       '(10 .10 100 1 10 1 0)

111:              SF-ADJUSTMENT _"Number of Frames" '(6  1   512 1 10 0 1)

112:              SF-TOGGLE     _"Invert direction" FALSE

113: )

 

 

¥|¡B¨ä¥L¨ç¼Æªº»¡©ú¡G

gimp-channel-ops-duplicate¨ç¼Æ

 

gimp-image-add-layer¨ç¼Æ

 

plug-in-waves¨ç¼Æ

 

46:(image (car (gimp-channel-ops-duplicate img)))

67:(gimp-image-add-layer image waves-layer -1)

70:(plug-in-waves 1 image waves-layer amplitude phase wavelength 0 FALSE)

¥ÑDB Browser¹ï¸Ü²°ªº¸ê®Æ¥i±À¥X²Ä46¦æ¡B²Ä67¦æ¡B²Ä70¦æ¬O¤°»ò·N«ä¡C