|
Namazu for hns による簡易全文検索 詳しくは 詳細指定/ヘルプを参照して下さい |
||||||||||||||||||||||||||||||||||||||||||
2026年02月28日(土) 旧暦 [n年日記] [更新:"2004/08/09 23:43:33"]#1 [gimp] my first script-fu
(GIMP 2.10)
Put fullowing code on ~/.config/GIMP/2.10/script directory
And try:
Filters
Script-Fu > Refresh script
File
Create >
Text >
Text Box
(script-fu-register
"script-fu-text-box" ;func name
"363 Text Box" ;menu label
"Creates a simple text box, sized to fit\
around the user's choice of text,\
font, font size, and color." ;description
"Michael Terry" ;author
"copyright 1997, Michael Terry;\
2009, the GIMP Documentation Team" ;copyright notice
"October 27, 1997" ;date created
"" ;image type that the script works on
SF-STRING "Text" "Text Box" ;a string variable
SF-FONT "Font" "Charter" ;a font variable
SF-ADJUSTMENT "Font size" '(49 1 1000 1 10 0 1)
;a spin-button
SF-COLOR "Color" '(0 0 0) ;color variable
SF-ADJUSTMENT "Buffer amount" '(30 0 100 1 10 1 0)
;a slider
)
(script-fu-menu-register "script-fu-text-box" "<Image>/File/Create/Text")
(define (script-fu-text-box inText inFont inFontSize inTextColor inBufferAmount)
(let*
(
; define our local variables
; create a new image:
(theImageWidth 10)
(theImageHeight 10)
(theImage)
(theImage
(car
(gimp-image-new
theImageWidth
theImageHeight
RGB
)
)
)
(theText) ;a declaration for the text
(theBuffer) ;create a new layer for the image
(theLayer
(car
(gimp-layer-new
theImage
theImageWidth
theImageHeight
RGB-IMAGE
"layer 1"
100
LAYER-MODE-NORMAL
)
)
)
) ;end of our local variables
(gimp-image-add-layer theImage theLayer 0)
(gimp-context-set-background '(255 255 255) )
(gimp-context-set-foreground inTextColor)
(gimp-drawable-fill theLayer BACKGROUND-FILL)
(set! theText
(car
(gimp-text-fontname
theImage theLayer
0 0
inText
0
TRUE
inFontSize PIXELS
"Sans")
)
)
(set! theImageWidth (car (gimp-drawable-width theText) ) )
(set! theImageHeight (car (gimp-drawable-height theText) ) )
(set! theBuffer (* theImageHeight (/ inBufferAmount 100) ) )
(set! theImageHeight (+ theImageHeight theBuffer theBuffer) )
(set! theImageWidth (+ theImageWidth theBuffer theBuffer) )
(gimp-image-resize theImage theImageWidth theImageHeight 0 0)
(gimp-layer-resize theLayer theImageWidth theImageHeight 0 0)
(gimp-layer-set-offsets theText theBuffer theBuffer)
(gimp-display-new theImage)
(list theImage theLayer theText)
)
)
( つっこみ )
|
最近の日記 2026年02月28日 ・my first script-fu 2026年01月29日 ・Die Fledermaus at New National theatre 2026/01/29 2025年12月25日 ・pbulk 11.99.3 (emacs30) 2025年11月22日 ・crash dump 2025年10月25日 ・recover from disk error | ||