±qscript_fu¤¤¾Ç²ß¼v¹³³B²z§Þ¥©¡G³±¼v¦r

 

        scripts¥Ø¿ý¤U¦³¶W¹L100­Ó *.scmÀÉ¡A³o¨Ç¬O¾Ç²ß¼v¹³³B²z§Þ¥©ªº³Ì¦n±Ð§÷¡CScript_fu¥D­n¤À¨âÃþ¡A¤@Ãþ¬O§@¥Î¦b¬J¦³ªº¼v¹³»P¹Ï¼h¤W¡A¥Ñ°õ¦æ[image] -> Script_Fu -> ¤U²£¥Íªº¯B°Ê¿ï³æ©Ò±Ò°Ê¡A¥t¤@ÃþScript_fu¥Ñ¤u¨ã²°¤WªºXtns -> Script_Fu¿ï³æ©Ò±Ò°Ê¡A°õ¦æ«á²£¥Í¤@­Ó·sªº¼v¹³µøµ¡Åã¥Üµ²ªG¡C

        ³±¼v¦r¬O¤å¦rÅܤƤ¤¤@­Ó±`¥Îªº§Þ¥©¡A[GIMP] -> Xtns -> Script_Fu -> Logos -> ¯B°Ê¿ï³æ¤º¦³³\¦h¤å¦r®ÄªG¥i¸É¨¬¤å¦r¤u¨ãªº¤£¨¬¡A³o¨ÇScript-Fuµ{¦¡²£¥Íªº¤å¦r®ÄªG«Ü¦h³£¥Î¤F³±¼v®ÄªG¡ABasic I³o­ÓScript-Fuµ{¦¡ºâ¬O·í¤¤µ{¦¡½X¸ûµuªº¤@­Ó¡A¥H¤U§Ú­Ì¨Ó¬ã¨sSpencer Kimball©Ò¼gªºbasic1-logo.scmµ{¦¡¡C

 

¤@¡B°õ¦æScript-Fu

³±¼v¦r

 

³±¼v¦r»Ý­n3­Ó¹Ï¼h

 

l          °õ¦æ[GIMP] -> Xtns -> Script_Fu -> Logos -> Basic I ²£¥Í¤@³±¼v¦r¡C

l          ³±¼v¦r»Ý­n3­Ó¹Ï¼h¡G¤å¦r³¡¤À¡B¶Â¦â³±¼v¡B¥Õ¦â­I´º¡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§@¨Ó²£¥Í³±¼v¦r¡CÂǥѳo¹Lµ{¨ÓÅé·|µ{¦¡½Xªº·N«ä¡C

 

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

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

¥H¹Ï§Î¨Ï¥ÎªÌ¬É­±²£¥Í³±¼v¦r¡A»Ý­nªº¨BÆJ¡G

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

¦b³z©ú¼h¼g¤WGimp

l          °õ¦æ[GIMP] -> File -> New¡A²£¥Í¤j¤p256x256³z©ú©³¦âªº¼v¹³¡C

l          ¥Î¤å¦r¤u¨ã¼g¤WGimp¡A¦¹®É¥u¦³¤@­Ó¹Ï¼h¡A±N¦¹¹Ï¼h§ó¦W¬°Gimp¡]»P§A©Ò¼g¦bªº¤å¦r¬Û¦P¡^¡C

 

41:(text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font))))

42: (gimp-image-undo-disable img)

43: (gimp-layer-set-name text-layer text)

44: (apply-basic1-logo-effect img text-layer bg-color text-color)

½Õ¾ã¼v¹³¤j¤p

l          ¨Ï¥ÎCrop¤u¨ã±NGimp¹Ï¼h½Õ¦¨¾A·í¤j¤p¡C

14::(gimp-image-resize img width height 0 0)

²£¥Í2­Ó¹Ï¼h

l          ¦b¾Þ§@¹Ï¼hªº¹ï¸Ü²°¤¤¡A²£¥Í2­Ó·sªº¹Ï¼h¡A¤@­Ó¦W¬°Background¹Ï¼h¡A¤@­Ó¦W¬°Shadow¹Ï¼h¡AShadow¹Ï¼hªº¹Ï¼h­«Å|¼Ò¦¡¬°MULTIPLY¡]burn¡^¿N¶Â¼Ò¦¡¡C

l          ¦ì©ó¤U­±ªº¹Ï¼h³]©w¤£¦Pªº²V¦â¼Ò¦¡µLªk¼vÅT¤U­±ªº¹Ï¼h¡CShadow¹Ï¼h³]MULTIPLY¼Ò¦¡¡AµLªk¼vÅT¨ìGimp¹Ï¼h¡C

l          3­Ó¹Ï¼h¥Ñ¤W¨ì¤Uªº±Æ¦C¶¶§Ç¬°¡GGimp¡BShadow¡BBackground¡C

10::(bg-layer (car (gimp-layer-new img width height RGBA_IMAGE "Background" 100 NORMAL)))

11:(shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow" 100 MULTIPLY)))

15: (gimp-image-add-layer img shadow-layer 1)

17: (gimp-image-add-layer img bg-layer 2)

¬°GimpµÛ¦â

l          ±N«e´ºÃC¦â³]¬°ÂŦâ¡C

l          ±NGimp¹Ï¼hªºKeep Transªºª¬ºA«ö¶s«ö¤U¡C

l          ¨Ï¥ÎÃC®Æ±í¤u¨ã¥Î«e´º¦â±NGimp¹Ï¼h¤W¦â¡C©³¦â³z©úªº³¡¤À¤£·|³Q¤W¦â¡A¤å¦r³¡¥÷Åܬ°ÂŦâ¡C

18: (gimp-palette-set-foreground text-color)

19: (gimp-layer-set-preserve-trans logo-layer TRUE)

20: (gimp-edit-fill logo-layer FG-IMAGE-FILL)

±N©³¦âÅÜ¥Õ¦â

l          ±N«e´ºÃC¦â³]¬°¥Õ¦â¡C

l          ¨Ï¥ÎÃC®Æ±í¤u¨ã¥Î­I´º¦â±NBackground¹Ï¼h¥Ñ³z©úÅܬ°¥Õ¦â¡C

21: (gimp-palette-set-background bg-color)

22: (gimp-edit-fill bg-layer BG-IMAGE-FILL)

 

Alpha to Select¿ï¨ú¤å¦r³¡¥÷

l          °õ¦æ[image] -> Edit -> Clear¡A½T©wShadow¹Ï¼h¥Ø«e¬O¥þ³z©úªº¡C

l          ¦b¾Þ§@¹Ï¼hªº¹ï¸Ü²°¤¤¡AÂI¿ïGimp¹Ï¼h«ö·Æ¹«¥kÁä¥X²{¤@¿ï³æ°õ¦æAlpha to Select¡A¦¹®ÉGimp¦r¼Ë¥X²{¤@­Ó³Q¿ï¨úªºµê½u¥~®Ø¡C

23: (gimp-edit-clear shadow-layer)

24: (gimp-selection-layer-alpha logo-layer)

»s§@³±¼v

l          ±N­I´ºÃC¦â³]¬°¶Â¦â¡C

l          ÂI¿ïShadow¹Ï¼h¡AÂI¿ï¼v¹³µøµ¡¡A°õ¦æ[image] -> Select -> Feather±N¿ï¨ú°Ï°ì¦Ð¤Æ7.5­Ó¹³¯À¡C

l          ±N¿ï¨úªº°Ï°ì¨Ï¥ÎÃC®Æ±í¤u¨ã¶ñ¤W­I´ºÃC¦â¡C

l          ¥Ñ©ó¦Ð¤Æ¿ï¨ú°Ï°ìªº¦]¯À¡A¨Ï±o¦rªºÃä½tÅܼҽk¡C

25Lgimp-palette-set-background ¡¥(0 0 0))

26: (gimp-selection-feather img 7.5)

27: (gimp-edit-fill shadow-layer BG-IMAGE-FILL)

¤j¥\§i¦¨

l          ¨ú®ø¿ï¨ú°Ï°ì¡C

l          ³]«e´º¦â¬°¥Õ¦â¡A¦¹®É­I´º¦â¬°¶Â¦â¡A¨Ï¥Îº¥¼h¶ñ¦â¤u¨ã¡A²V¦X¼Ò¦¡¬°MULTIPLY¡A±q¥ª¤W¨¤¨ì¥k¤U¨¤©Ô¤@±ø½u¡C¥ª¤W¨¤¥Õ¦â»PÂŦâ¥H¿N¶Â¼Ò¦¡²V¦X¤´ºû«ùÂŦâ¡A¥k¤U¨¤¶Â¦â»PÂŦâ¥H¿N¶Â¼Ò¦¡²V¦XÅܶ¦â¡C

l          ¹ïShadow¹Ï¼h¡A°õ¦æ[image] -> Transforms -> Offset¡A±NShadow¹Ï¼h©¹¤U©¹¥ª³£²¾°Ê3­Ó¹³¯À¡C

l          MULTIPLY¼Ò¦¡ªº­ì²z¡G±N¨âºØÃC¦â¬Û­¼¡]A¡ÑB¡Ò255¡^¡A¦]¦¹¥X²{ªºµ²ªG¦h¸û­ì¦â±m²`¡C¥ô¦ó¦â±m©M¶Â¦â¬Û¥[¦¨§¡Åܬ°¶Â¦â¡A¦]¬°¶Â¦â¬°0¡A¥ô¦ó¼Æ­¼0³£ÅÜ0¡F¥ô¦ó¦â±m©M¥Õ¦â¬Û¥[¦¨§¡ºû«ù­ì¦â¡A¦]¬°¥Õ¦â¬°255¡A¥ô¦ó¼Æ­¼255¦A°£255ºû«ù¤£ÅÜ¡C

28:(gimp-selection-none img)

29: (gimp-palette-set-foreground '(255 255 255))

30: (gimp-blend logo-layer FG-BG-RGB MULTIPLY RADIAL 100 20 REPEAT-NONE FALSE 0 0 0 0 width height)

31: (gimp-layer-translate shadow-layer 3 3)

 

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

l          ­ìµ{¦¡½Xbasic1-logo.scm¤¤¡A(define (script-fu-basic1-logo-alpha)»P(script-fu-register "script-fu-basic1-logo-alpha")³o¨â³¡¥÷«Å§i¨Ãµù¥U¤@­Ó§@¥Î¦b¼v¹³ªºScript_fu¨ç¼Æ¡A¦b¥»¤å¤¤¥Î¤£¨ì¡A¬G¦b¤U­±ªº­ì©l½X¤¤§Ú±N¥¦­Ì§R°£¡C

l          µ{¦¡½X¤À¤T³¡¥÷

l          4~33¦æ¡G(define (apply-basic1-logo-effect  ))

l          35~47¦æ:¡G(define (script-fu-basic1-logo   )) ¡A¨Ï¥Îapply-basic1-logo-effect¨ç¼Æ²£¥Í³±¼v¦r

l          48~59¦æ¡G(script-fu-register "script-fu-basic1-logo"  )

 

 

 

 

1:  ;  DROP-SHADOW-LOGO

2:  ;  draw the specified text over a background with a drop shadow

3:

4:  (define (apply-basic1-logo-effect img

5:                                    logo-layer

6:                               bg-color

7:                               text-color)

8:       (let* ((width (car (gimp-drawable-width logo-layer)))

9:                 (height (car (gimp-drawable-height logo-layer)))

10:          (bg-layer (car (gimp-layer-new img width height RGBA_IMAGE "Background" 100 NORMAL)))

11:           (shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow" 100 MULTIPLY)))

12:        (old-fg (car (gimp-palette-get-foreground)))

13:        (old-bg (car (gimp-palette-get-background))))

14:          (gimp-image-resize img width height 0 0)

15:          (gimp-image-add-layer img shadow-layer 1)

17:          (gimp-image-add-layer img bg-layer 2)

18:          (gimp-palette-set-foreground text-color)

19:          (gimp-layer-set-preserve-trans logo-layer TRUE)

20:          (gimp-edit-fill logo-layer FG-IMAGE-FILL)

21:          (gimp-palette-set-background bg-color)

22:          (gimp-edit-fill bg-layer BG-IMAGE-FILL)

23:          (gimp-edit-clear shadow-layer)

24:          (gimp-selection-layer-alpha logo-layer)

25:          (gimp-palette-set-background '(0 0 0))

26:          (gimp-selection-feather img 7.5)

27:          (gimp-edit-fill shadow-layer BG-IMAGE-FILL)

28:          (gimp-selection-none img)

29:          (gimp-palette-set-foreground '(255 255 255))

30:          (gimp-blend logo-layer FG-BG-RGB MULTIPLY RADIAL 100 20 REPEAT-NONE FALSE 0 0 0 0 width height)

31:          (gimp-layer-translate shadow-layer 3 3)

32:          (gimp-palette-set-background old-bg)

33:          (gimp-palette-set-foreground old-fg)))

34:

 

35:    (define (script-fu-basic1-logo text

36:                     size

37:                   font

38:                          bg-color

39:                          text-color)

40:         (let* ((img (car (gimp-image-new 256 256 RGB)))

41:              (text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font))))

42:              (gimp-image-undo-disable img)

43:              (gimp-layer-set-name text-layer text)

44:              (apply-basic1-logo-effect img text-layer bg-color text-color)

45:              (gimp-image-undo-enable img)

46:              (gimp-display-new img)))

47:

 

48:    (script-fu-register "script-fu-basic1-logo"

49:               _"<Toolbox>/Xtns/Script-Fu/Logos/Basic I..."

50:               "Creates a simple logo with a drop shadow"

51:               "Spencer Kimball"

52:               "Spencer Kimball"

53:               "1996"

54:               ""

55:               SF-STRING     _"Text" "The Gimp"

56:               SF-ADJUSTMENT _"Font Size (pixels)" '(100 2 1000 1 10 0 1)

57:               SF-FONT       _"Font" "-*-Dragonwick-*-r-*-*-24-*-*-*-p-*-*-*"

58:               SF-COLOR      _"Background Color" '(255 255 255)

59:               SF-COLOR      _"Text Color" '(6 6 206))

l          ¥Ñ°Ñ¼Æ¿é¤J¹ï¸Ü²°¥i©ú¥Õscript-fu-register¨ç¼Æ¤¤°Ñ¼Æªº·N«ä¡C

 

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

gimp-blend

30: (gimp-blend logo-layer FG-BG-RGB MULTIPLY RADIAL 100 20 REPEAT-NONE FALSE 0 0 0 0 width height)

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

 

Blend°Ñ¼Æ³]©w¹ï¸Ü²°

l          30: (gimp-blend logo-layer FG-BG-RGB MULTIPLY RADIAL 100 20 REPEAT-NONE FALSE 0 0 0 0 width height)

l          gimp-blend¨ç¼Æ©Ò¿é¤Jªº°Ñ¼Æ¡A¬Û·í©ó¤W¹ÏBlend Tools Options°Ñ¼Æ³]©w¹ï¸Ü²°³o¼Ë³]©w¡C