Script baffling
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
Script baffling | Roger Penn | 25 Feb 04:49 |
Script baffling | Kevin Cozens | 25 Feb 07:00 |
Script baffling | saulgoode@flashingtwelve.brickfilms.com | 25 Feb 07:44 |
Script baffling | Roger Penn | 26 Feb 02:24 |
Script baffling
Folks, I am at my wit's end.
The included script worked just fine before upgrading from 2.2 to 2.6. I've been all through the migration guide, etc. and can't figure out why this script that has always worked fine, now suddenly returns "error: Procedure execution of gimp-image-convert-indexed failed on invalid input arguments: Image 'bulletin.gif' (13) is already of type 'indexed' "
The first thing I do after opening the image is to call (gimp-img-convert-rgb img), which I know works, because the script then proceeds to do all sorts of things that can't be done on an indexed image. So clearly it isn't already of type 'indexed' and something is just plain broken here.
Can anyone help please? Thanks! I know the list doesn't like attachments, so I haven't attached the bulletin.gif, but I can if you need it.
Script:
(define (BulletinBoard_Blue_Header inText inFilename)
(let* (
(drawable -1)
(text inText)
(filename inFilename)
(gimp-context-set-foreground '(41 11 169))
(img (car (gimp-file-load 1
"C:\\userfiles\\admin\\images\\GIMP\\bulletin.gif" "bulletin.gif")))
(gimp-image-convert-rgb img)
(background-layer (car (gimp-image-get-active-drawable img)))
(gimp-hue-saturation background-layer 0 -108 0 0)
(size 48)
(font "Inkpen2 Script")
(text-layer (car (gimp-text-fontname img -1 0 0 text 0 TRUE size PIXELS
font)))
(height (car (gimp-drawable-height text-layer)))
(width (car (gimp-drawable-width text-layer)))
(scale (/ 600 width))
(scale-width (trunc (* width scale)))
(scale-height (trunc (* height scale)))
(if (< scale 1)
(gimp-layer-scale text-layer 600 scale-height 0 0)
)
(height (car (gimp-drawable-height text-layer)))
(width (car (gimp-drawable-width text-layer)))
(theAngle 5)
(radians (* theAngle (/ 3.14 -180)))
(x-val (/ height 2))
(y-val (/ height 2))
(x-offset (/ (- 650 width) 2))
(y-offset (/ (- 120 height) 2))
(bg-color '(255 255 255))
)
(gimp-selection-none img)
(gimp-layer-resize text-layer (+ 10 width) height 10 0)
(gimp-layer-set-preserve-trans text-layer TRUE)
(gimp-layer-translate text-layer x-offset y-offset)
(gimp-drawable-transform-rotate text-layer radians TRUE x-val y-val 0 2
TRUE 3 FALSE)
(gimp-selection-none img)
(gimp-layer-set-preserve-trans text-layer FALSE)
(plug-in-unsharp-mask 1 img text-layer 2 .5 8)
(gimp-image-merge-down img text-layer 2)
(gimp-image-convert-indexed img NO-DITHER MAKE-PALETTE 255 FALSE 1
"ignore")
(set! drawable (car (gimp-image-get-active-layer img)))
(gimp-file-save 1 img drawable filename filename)
))
(script-fu-register "BulletinBoard_Blue_Header"
_"_BulletinBoard Blue Header"
"Masthead treatment for COL Layout5a_BulletinBoard_Blue Designs"
"Roger Penn"
"Roger Penn"
"2007"
""
SF-STRING _"Text" "Community Church"
SF-STRING _"File Name"
"C:\\gimppics\\bulletinboard.gif"
)
(script-fu-menu-register "BulletinBoard_Blue_Header" _"/Xtns/Script-Fu/COL")
Script baffling
Roger Penn wrote:
The included script worked just fine before upgrading from 2.2 to 2.6. I've
[snip]
(define (BulletinBoard_Blue_Header inText inFilename) (let* (
(drawable -1)
(text inText)
(filename inFilename)
(gimp-context-set-foreground '(41 11 169)) (img (car (gimp-file-load 1
"C:\\userfiles\\admin\\images\\GIMP\\bulletin.gif" "bulletin.gif"))) (gimp-image-convert-rgb img)
Your script is calling "gimp-image-convert-rgb" in the variable bindings part of the let*. It needs to be in the body of the let*. Move the line to just before or after the call to "gimp-selection-none".
Script baffling
Quoting Kevin Cozens :
Roger Penn wrote:
The included script worked just fine before upgrading from 2.2 to 2.6. I've
[snip]
(define (BulletinBoard_Blue_Header inText inFilename) (let* (
(drawable -1)
(text inText)
(filename inFilename)
(gimp-context-set-foreground '(41 11 169)) (img (car (gimp-file-load 1
"C:\\userfiles\\admin\\images\\GIMP\\bulletin.gif" "bulletin.gif"))) (gimp-image-convert-rgb img)Your script is calling "gimp-image-convert-rgb" in the variable bindings part of the let*. It needs to be in the body of the let*. Move the line to just before or after the call to "gimp-selection-none".
I would add that likewise the script is attempting to call 'gimp-context-set-foreground', 'gimp-hue-saturation' and (conditionally) 'gimp-layer-scale' within the binding block. The actual effect of this is that new, local variables are created and assigned the values of the ensuing expressions. The line that attempts to conditionally call 'gimp-layer-scale' is particularly problematic because it is redefining "if" (though only for the duration of the let*).
Script baffling
Thanks very much folks. I discovered this by accident when I couldn't figure out why the gimp-hue-saturation wasn't working, and I wasn't sure why moving that fixed it, just that it did. I just wish I knew scheme better, but this kind of getting my fingernails dirty is sure helping! Again, thanks for the very helpful help!
On Thu, Feb 24, 2011 at 11:44 PM, wrote:
Quoting Kevin Cozens :
Roger Penn wrote:
The included script worked just fine before upgrading from 2.2 to 2.6.
I've
[snip]
(define (BulletinBoard_Blue_Header inText inFilename) (let* (
(drawable -1)
(text inText)
(filename inFilename)
(gimp-context-set-foreground '(41 11 169)) (img (car (gimp-file-load 1
"C:\\userfiles\\admin\\images\\GIMP\\bulletin.gif" "bulletin.gif"))) (gimp-image-convert-rgb img)Your script is calling "gimp-image-convert-rgb" in the variable bindings part of the let*. It needs to be in the body of the let*. Move the line
to
just before or after the call to "gimp-selection-none".
I would add that likewise the script is attempting to call 'gimp-context-set-foreground', 'gimp-hue-saturation' and (conditionally) 'gimp-layer-scale' within the binding block. The actual effect of this is that new, local variables are created and assigned the values of the ensuing expressions. The line that attempts to conditionally call 'gimp-layer-scale' is particularly problematic because it is redefining "if" (though only for the duration of the let*).
_______________________________________________ Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer