Script-Fu: Text in a transparent image
Hi Nicu,
I want to create a
script that will generate a transparent gif with my email address.
Below you find a script, which makes a RGB-image with transparent
background. I also tried it once with Mike Terrys totorial.
I tried to convert it to INDEXED, but the output is quite ugly.
Regards, Hago
......................
(define (script-fu-text-box1 inText inFont inFontSize inSpiel inTextColor)
(set! theImageWidth 10)(set! theImageHeight 10)
(set! theImage (car (gimp-image-new theImageWidth theImageHeight RGB) ) )
(set! theLayer (car (gimp-layer-new theImage theImageWidth
theImageHeight 0 "layer1" 100 0) ) )
(gimp-image-add-layer theImage theLayer 0)
(gimp-layer-add-alpha theLayer)
(gimp-palette-set-foreground inTextColor)
(gimp-selection-all theImage)
(gimp-edit-clear theLayer)
(gimp-selection-none theImage)
(set! theText (car (gimp-text theImage theLayer 0 0 inText 0 TRUE
inFontSize 0 "*" inFont "f" "*" "*" "*" "*" "*") ) )
(set! theImageWidth (car (gimp-drawable-width theText) ) )
(set! theImageHeight (car (gimp-drawable-height theText) ) )
;(set! theBuffer (* theImageHeight (/ inSpiel 100) ) )
(set! theImageWidth (+ theImageWidth inSpiel inSpiel) )
(set! theImageHeight (+ theImageHeight inSpiel inSpiel) )
(gimp-layer-set-offsets theText inSpiel inSpiel)
(gimp-image-resize theImage theImageWidth theImageHeight 0 0)
(gimp-layer-resize theLayer theImageWidth theImageHeight 0 0)
(gimp-image-merge-visible-layers theImage 0)
;(gimp-convert-indexed theImage 0 0 255 1 1 "blah")
(gimp-display-new theImage)
(cons theImage (cons theLayer (cons theText () )
) )
)
(script-fu-register "script-fu-text-box1"
_"/Xtns/Script-Fu/Text/Text Box1"
"Erstellt eine einfache TextBox."
""
""
""
"RGB"
SF-VALUE "Text:" "\"Text Box\""
SF-VALUE "Font:" "\"Arial\""
SF-VALUE "FontSize:" "45"
SF-VALUE "Spielraum:" "20"
SF-COLOR "TextColor:" '(255 0 0)
)