Post Reply 

set-active-channel problem

Feb 12, 2011, 14:19
Post: #1
set-active-channel problem
Hello everybody,

I'm completely new to fu-scripting,

I have a problem using scrip-fu-distress-selection, it causes the following error :

Quote:(gimp:3091): Gimp-Core-CRITICAL **: gimp_image_set_active_channel: assertion `channel == NULL || gimp_container_have (image->channels, GIMP_OBJECT (channel))' failed

GIMP-Avertissement: Plug-In '(null)' left image undo in inconsistent state, closing open undo groups.

The script I made is very simple : select black color, feather the selection and distress it. It works well without the distress part.

Any suggestion that would help me out ?

(define (simple-script filename)

   (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))

          (drawable (car (gimp-image-get-active-layer image)))

(width (car (gimp-drawable-width image)))

         (height (car (gimp-drawable-height image))))

(gimp-context-set-background '(98 123 0))

(gimp-context-set-foreground '(144 176 17))

(gimp-by-color-select drawable '(0 0 0) 0 2 1 0 0 1)

(gimp-selection-feather image 10)

(gimp-selection-sharpen image)

; (script-fu-distress-selection RUN-NONINTERACTIVE image drawable 127 1 1 1 1 1)

(gimp-edit-blend drawable 0 0 0 100 0 0 0 0 0 0 0 0 0 width height)

(gimp-selection-invert image)

(gimp-context-set-background '(255 255 255))

(gimp-edit-fill drawable 1)

     (gimp-file-save RUN-NONINTERACTIVE image drawable "/home/alexis/img2.jpg" filename)

     (gimp-image-delete image)))

I learnt from the GIMP API that, for the set_active_channel method :
Quote: "An exception is a previously existing floating selection, in which case this procedure will return an execution error."
I don't know whether or not this explains my error.

Maybe readind the script-fu-distress source code would help, how could I that ?


NB : the script is used in terminal-mode, not as a gimp plugin.
Find all posts by this user
Quote this message in a reply
Feb 12, 2011, 22:26 (This post was last modified: Feb 12, 2011 22:26 by ofnuts.)
Post: #2
RE: set-active-channel problem
The source code is in /usr/share/gimp/2.0/scripts/distress-selection.scm (in Windows, it could be somewhere under "c:\Program files\gimp" or wherever Gimp is installed on your system.

This said, an "assert" is something used to check that some assertion holds true before a piece of code executed, and an assertion failure is usually the mark of something that should never happen, so it looks more like a Gimp bug...

Looking at the code, the problem seems to occur at the end of the plugin when it restores the "current layer" from its "drawable" argument, that is normally the active layer when the script is run interactively. So I'd suspect that in turn the drawable arg to your script is not correct (maybe not set because there is no layer selected when your script starts).

Bonne chance...Smile

Now answering your questions on
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  2.6 11 Foundry FX copyright problem progr 1 196 Aug 17, 2017 05:11
Last Post: ythgilb
  [Script-Fu Error] set! function is interpreted as an illegal function image_artist 2 360 Sep 11, 2014 20:54
Last Post: image_artist
  Uber N00B script problem... fred_flag 2 393 May 30, 2014 15:01
Last Post: fred_flag
  Script/plugin problem MazZi 12 790 May 29, 2014 14:53
Last Post: MazZi
  Can a text layer be set to a zero length string? Bob 1 366 Apr 29, 2014 00:08
Last Post: ofnuts

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS