-
-
Save apeckham/44b73b6172c0a833794c8f36049a2dc6 to your computer and use it in GitHub Desktop.
script-fu.scheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from https://docs.gimp.org/en/gimp-using-script-fu-tutorial-result.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(+ 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