Hello list,

I am planning on evolving image transformations using an AST of the
script-fu langauge and generating random (but syntatically correct)
scripts.  I would like to avoid programming in hundreds of corner
cases into the system and thus have the following questions:

1) Script-fu throws exceptions

If/when I do something basic like call "gimp-image-raise-layer" on a
layer that can not be raised, an exception is thrown.  I would very
much like to catch/ignore exceptions such as this but it seems
script-fu is too primitive.  Am I missing something?

2) gimp-layer-new-from-drawable nearly always fails

------------- CODE --------------
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE "image.png" "image.png")))
        (layer0 (car (gimp-image-get-active-layer image))))
        (let* ((layer1 (car (gimp-image-flatten image))))
        (gimp-layer-set-mode layer1 25)
)       (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image))))
----------------- END CODE --------------

In the above you see I define layer0 as the active layer (which I
thought was a drawable) but this doesn't work for
gimp-layer-new-from-drawable.  Replacing layer0 with 'image' also
doesn't work and most frustratingly, using "
(gimp-image-get-active-drawable image)" also doesn't work - which I
really thought it should based on the documentation.  What does this
function expect?

(I understand gimp-image-flatten somehow screws everything up by
eliminating the layer, but am still not clear how to once-again get a
valid layer from my image)

3) C Assertation failures
Perhaps most concerning are the assertation failures.  Presumably,
these are not supposed to happen.  How concerned should I be?

-------------------- START CONSOLE DUMP -------------------------
> (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE "image.png" 
> "image.png")))
        (layer0 (car (gimp-image-get-active-layer image))))
        (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image))))
        (gimp-layer-add-alpha layer1)
        (gimp-image-merge-down image layer1 2))
        (set! layer0 (gimp-image-get-active-layer image))
        (let* ((layer1 (car (gimp-image-flatten image))))
        (gimp-layer-set-opacity layer1 21.811554)
        (gimp-image-merge-down image layer1 0))
        (set! layer0 (gimp-image-get-active-layer image))
        (let* ((layer1 (car (gimp-layer-new-from-drawable layer0 image))))
        (gimp-layer-flatten layer1)
        (gimp-image-merge-down image layer1 0))
        (set! layer0 (gimp-image-get-active-layer image))
(let* ((currDraw (car (gimp-image-get-active-layer image))))
(gimp-file-save RUN-NONINTERACTIVE image currDraw "newImage.png"
"newImage.png" ))

(gimp-console:2987): Gimp-Core-CRITICAL **: gimp_image_remove_layer:
assertion `gimp_container_have (image->layers, GIMP_OBJECT (layer))'

---------------------------- END CONSOLE DUMP -------------------------

Gimp-user mailing list

Reply via email to