04-19-2020, 07:44 AM
(This post was last modified: 04-19-2020, 09:00 AM by JimmyMarco.)
Hello Pocholo,
The problem is : your script has two different layers names : baseLayer and theLayer
Only one is needed : theLayer
Other details :
- None argument has to be passed to your script, so "construtor" is only the script name
- Undo group (start/end) is useful when a script modify an image, for image generator use undo (disable/enable)
- Indent with tabs instead of spaces
- Comment to explain what the code does
Have fun.
@+++
The problem is : your script has two different layers names : baseLayer and theLayer
Only one is needed : theLayer
Other details :
- None argument has to be passed to your script, so "construtor" is only the script name
- Undo group (start/end) is useful when a script modify an image, for image generator use undo (disable/enable)
- Indent with tabs instead of spaces
- Comment to explain what the code does
Have fun.
@+++
Code:
; "New Image" image generator (new-image.scm)
; This script creates an image 500 x 500 filled with white background
; Pocholo
; 2020/04/19
;
(define (script-fu-new-image)
(let* (
(theImage (car (gimp-image-new 500 500 RGB)))
(theLayer (car (gimp-layer-new theImage 500 500 RGB-IMAGE "Wood" 100 LAYER-MODE-NORMAL)))
)
(gimp-image-undo-disable theImage) ; Disable undo during the image creation
(gimp-image-insert-layer theImage theLayer 0 0)
(gimp-drawable-fill theLayer FILL-WHITE)
(gimp-display-new theImage)
(gimp-image-undo-enable theImage) ; Enable undo for future modifications
)
)
(script-fu-register
"script-fu-new-image"
"<Image>/File/Create/New image..."
"Creates a New image"
"Pocholo"
"Pocholo"
"March 2020"
""
)