Post Reply 

Script-fu problems

Jun 9, 2014, 03:19 (This post was last modified: Jun 10, 2014 08:24 by Pokedan.)
Post: #1
Script-fu problems
This is my first script-fu, meant to go through a folder and run an unsharpen filter on all PNG files in that folder, there's still a lot to do but it's bugging up with the error "Error: ( : 1) illegal function". So if you would kindly point out my huge mistakes, I would be very thankful.

Oh yes, also, "SF-SLIDER" doesn't seem to be working.

Code:
(define (script-fu-unsharpen-mass image layer radius)
    (let* ((filelist (cadr (file-glob "/Users/grunow/Desktop/test/*.png" 0))))
        (while (not (null? filelist))
           (let* ((filename (car filelist)))
                 (image (car (file-png-load 0 filename filename)))
                 (layer (car (gimp-image-get-active-layer image)))
             (plug-in-unsharp-mask 0 image layer radius amount threshold)
             (gimp-file-save 0 image layer filename filename)
            )
        )
    )
    (set! filelist (cdr filelist))
)
(script-fu-register "script-fu-unsharpen-mass"
    "<Image>/Filters/Enhance/Unsharpen Mass..."
    "Unsharpen every PNG in a directory."
    "Pokedan"
    "Pokedan"
    "08/06/14"
    "RGB*, GRAY*"
    SF-IMAGE "Image" 0
    SF-DRAWABLE "Layer" 0
    SF-ADJUSTMENT "Radius"    '(5 0.1 500 4.5 1 1 SF-SLIDER)
    SF-ADJUSTMENT "Amount"    '(0.5 0 10 0.09 0.1 2 SF-SLIDER)
    SF-ADJUSTMENT "Threshold" '(0 0 255 2 10 0 SF-SLIDER)
)


Attached File(s)
.scm  script-fu-unsharpen-mass.scm (Size: 941 bytes / Downloads: 28)
Find all posts by this user
Quote this message in a reply
Jun 9, 2014, 04:59
Post: #2
RE: Script-fu problems
I see two things wrong.

In the register block you have defined threshold and amount parameters, but you haven't included them in the definition of your function:
Code:
(define (script-fu-unsharpen-mass image layer radius)
should be
Code:
(define (script-fu-unsharpen-mass image layer radius amount threshold)

Kevin
Find all posts by this user
Quote this message in a reply
Jun 9, 2014, 06:46
Post: #3
RE: Script-fu problems
I updated it, but it's still giving me the same error.
Find all posts by this user
Quote this message in a reply
Jun 9, 2014, 15:54
Post: #4
RE: Script-fu problems
(Jun 9, 2014 06:46)Pokedan Wrote:  I updated it, but it's still giving me the same error.

I've sometimes seen the Illegal function error when the script file has non-ASCII characters in it. Could you try attaching it to a post so we can have a look at it.

Kevin
Find all posts by this user
Quote this message in a reply
Jun 13, 2014, 09:26
Post: #5
RE: Script-fu problems
(Jun 9, 2014 15:54)paynekj Wrote:  
(Jun 9, 2014 06:46)Pokedan Wrote:  I updated it, but it's still giving me the same error.

I've sometimes seen the Illegal function error when the script file has non-ASCII characters in it. Could you try attaching it to a post so we can have a look at it.

Kevin

Done.
Find all posts by this user
Quote this message in a reply
Jun 13, 2014, 11:02
Post: #6
RE: Script-fu problems
Once I got all the indenting the way I like it, I can see that the possible problem is that you have the (set! filelist (cdr filelist)) in the wrong place. It needs to be inside the while loop otherwise the while loop will never end because filelist will never change.

Kevin
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Request for script chlebna 1 172 Sep 13, 2017 09:35
Last Post: ythgilb
  Request for script - Guillotine + Watermark sunslick 1 230 Sep 4, 2017 08:51
Last Post: ythgilb
  Script-fu: How to create new, addressable layer using gimp-floating-sel-to-layer Bertholom√§us 2 231 Aug 31, 2017 14:32
Last Post: Bertholomäus
  How to modify this script-fu? Zakary81 1 196 Aug 23, 2017 12:48
Last Post: paynekj
  Need help in running a gui script-fu via command line eyalzek 2 356 Oct 4, 2014 14:05
Last Post: eyalzek

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS