Skip to content

Instantly share code, notes, and snippets.

@apeckham
Last active January 8, 2018 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apeckham/44b73b6172c0a833794c8f36049a2dc6 to your computer and use it in GitHub Desktop.
Save apeckham/44b73b6172c0a833794c8f36049a2dc6 to your computer and use it in GitHub Desktop.
script-fu.scheme
from https://docs.gimp.org/en/gimp-using-script-fu-tutorial-result.html
(+ 2 3)
(gimp-message "test you")
(define (script-fu-text-box inText inFont inFontSize inTextColor inBufferAmount)
(let*
(
(theImageWidth 10)
(theImageHeight 10)
(theImage)
(theImage
(car
(gimp-image-new
theImageWidth
theImageHeight
RGB
)
)
)
(theText)
(theBuffer)
(theLayer
(car
(gimp-layer-new
theImage
theImageWidth
theImageHeight
RGB-IMAGE
"layer 1"
100
NORMAL
)
)
)
)
(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-file-save RUN-NONINTERACTIVE theImage theImage "/code/x.png" "/code/x.png")
)
)
(script-fu-text-box "hello worlddddddd" "Courier" 24 '(100 50 100) 100)
(gimp-message "test you2")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment