Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > GIMP (GNU Image Manipulation Program) > Re: making a sc...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 21 of 24 Topic 3079 of 3157
Post > Topic >>

Re: making a script

by floyd@[EMAIL PROTECTED] (Floyd L. Davidson) Sep 26, 2008 at 01:21 AM

houghi <houghi@[EMAIL PROTECTED]
> wrote:
>Floyd L. Davidson wrote:
>> houghi <houghi@[EMAIL PROTECTED]
> wrote:
>>>I got as far as the following:
>>>gimp -i -d -b "(script-fu-fuzzy-border \"foo.png\" RUN-NONINTERACTIVE
>>>\'(100;100;100) 100 0 16 0 0 0 1)" -b '(gimp-quit 0)'
>>> batch command: executed successfully.
><snip>
>
>> You are using the batch mode to execute a scheme script
>> that operates on a previously loaded image.  The scheme
>> script was written be a menu option available for
>> interactive users, and does nothing to load such an
>> image.  Note that "foo.png" is not an image, it is a
>> *file*, and the "script-fu-fuzzy-border" function
>> requires an image for the first argument.  (I can't
>> relate argument list in the example command above to the
>> argument list required by script-fu-fuzzy-border.)
>
>So what you are saying is that it won't work. Bit strange, because other
>things that I do that way WILL work.

That simply *cannot* be true.  Your argument list has
nothing to do with the require arguments of the function
you are calling.  And there is no code in that function to
load an image from a file.

It *cannot* work.

>> To use the "script-fu-fuzzy-border" function in batch
>> mode you need to first execute the required gimp
>> functions to load an image by reading one from a file.
>
>OK and how do I do that?

You have to *read* the rest of the article you are
responding to one line at a time, multiple times if
necessary, until you *understand* the entire article.
Do that *before* asking stupid questions about each line
that are answered on the next line or in the next
paragraph.

>I think the sample script is lousy for learning. I have read it many
>times over the years and I have not learned anything.

What can anyone say?  Maybe this just isn't something
you are cut out to do.  I can't compose music, or even
play it, and if I asked questions like yours of a
composer I'd expect to be told to go do something like
programming...

Maybe you should compose music! :-)

Here's the script you need to batch process fuzzy borders.

; batchfuzzy.scm
;
; Apply script-fu-fuzzy-border as a batch process.
;
; Batchfuzzy is copyright 2008 by Floyd L. Davidson, floyd@[EMAIL PROTECTED]
 Script-fu-fuzzy-border is defined in fuzzyborder.scm, which is
; copyright by Chris Gutteridge, cjg@[EMAIL PROTECTED]
 This file should be placed in directory ~/.gimp-2.4/scripts with
; a filename that ends with ".scm".
;
; GIMP is then called from the command line to process all files
; that fit the specified pattern.  Command line syntax is:
;
;   gimp -i -c -d -b '(batch_fuzzy_border "pattern" "color" \
;                     border_size toggle_blur granularity   \
;                     toggle_shadow percent_shadow)' -b '(gimp-quit 0)'
;
;    "pattern"     : a regular expression pattern specifying files
;                     (example:  "*.jpg")
;
;    "color"       : color of the border
;                     (example:  "pink")
;
;    border_size   : border size in pixels
;                     (example:  20)
;
;    toggle_blur   : blur toggle, 1/0 or TRUE/FALSE
;                     (example:  TRUE)
;
;    granularity   : granularity, 1 or more where 1 is low
;                     (example:  4)
;
;    toggle_shadow : toggle shadow, 1/0 or TRUE/FALSE
;                     (example:  TRUE)
;
;    percent_shadow: percent of border that is shadowed
;                     (example:  75)
;
;  A typical example of a command line to invoke this program is:
;
;   gimp -i -c -d -b '(batch_fuzzy_border "*.jpg" "pink" 40 \
;        TRUE 10 TRUE 50 )' -b '(gimp-quit 0)'
;
;
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.

(define (batch_fuzzy_border  pattern
                             color
                             size
                             blurt
                             gran
                             shadowt
                             shadowp)

  (let* ((filelist (cadr (file-glob pattern 1))))
    (while (not (null? filelist))
           (let* ((filename (car filelist))
                     (image (car (gimp-file-load RUN-NONINTERACTIVE
filename filename)))
                     (drawable (car (gimp-image-get-active-layer image))))
               (script-fu-fuzzy-border image drawable color size blurt
gran shadowt shadowp FALSE TRUE)
               (set! drawable (car (gimp-image-get-active-layer image)))
               (gimp-file-save RUN-NONINTERACTIVE image drawable filename
filename)
               (gimp-image-delete image))
    (set! filelist (cdr filelist)))))
;
; End of batchfuzzy.scm file.

-- 
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)              floyd@[EMAIL PROTECTED]

 




 24 Posts in Topic:
making a script
-=MrX=- <herrie@[EMAIL  2008-09-22 18:41:57 
Re: making a script
houghi <houghi@[EMAIL   2008-09-22 21:21:18 
Re: making a script
houghi <houghi@[EMAIL   2008-09-22 23:24:26 
Re: making a script
-=MrX=- <herrie@[EMAIL  2008-09-23 16:51:10 
Re: making a script
houghi <houghi@[EMAIL   2008-09-23 17:07:05 
Re: making a script
houghi <houghi@[EMAIL   2008-09-23 22:24:15 
Re: making a script
-=MrX=- <herrie@[EMAIL  2008-09-24 16:03:14 
Re: making a script
houghi <houghi@[EMAIL   2008-09-24 16:53:08 
Re: making a script
-=MrX=- <herrie@[EMAIL  2008-09-25 08:21:13 
Re: making a script
houghi <houghi@[EMAIL   2008-09-25 11:20:33 
Re: making a script
Troy Piggins <usenet-0  2008-09-23 08:00:12 
Re: making a script
floyd@[EMAIL PROTECTED]   2008-09-25 04:57:05 
Re: making a script
houghi <houghi@[EMAIL   2008-09-25 16:05:01 
Re: making a script
houghi <houghi@[EMAIL   2008-09-26 01:15:43 
Re: making a script
Niels Giesen <niels.gi  2008-09-26 09:53:44 
Re: making a script
houghi <houghi@[EMAIL   2008-09-26 12:04:58 
Re: making a script
Giacomo Boffi <giacomo  2008-09-26 12:34:41 
Re: making a script
houghi <houghi@[EMAIL   2008-09-26 12:56:37 
Re: making a script
Niels Giesen <niels.gi  2008-09-26 22:03:52 
Re: making a script
houghi <houghi@[EMAIL   2008-09-26 20:38:05 
Re: making a script
floyd@[EMAIL PROTECTED]   2008-09-26 01:21:17 
Re: making a script
houghi <houghi@[EMAIL   2008-09-26 12:51:49 
Re: making a script
houghi <houghi@[EMAIL   2008-09-26 22:13:07 
Re: making a script
Dirk Dietrich <kaufinf  2008-10-03 18:16:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Dec 4 17:13:58 CST 2008.