making a script
Message-ID:<48d7cad5$1_5@news4us.nl>
Subject:
making a script
Date:Mon, 22 Sep 2008 17:41:57 +0100
Hi I use Gimp just for 2 things. - resizing pictures to a standard format - filters - decor - fuzzy border (each time same border) Can I make a script what does this for me ? tia Paulx
Message-ID:<slrngdfs1e.a47.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Mon, 22 Sep 2008 20:21:18 +0100
-=MrX=- wrote: > > > Hi > > I use Gimp just for 2 things. > > - resizing pictures to a standard format > - filters - decor - fuzzy border (each time same border) > > Can I make a script what does this for me ? Yes. Resizing is easier with ImageMagick. I use some scripting with the making of wallpapers. http://houghi.org/script/00_personal_scripts/wallpaper_maker does the following. It takes an image, makes it the right height, puts a fuzzy border around it and then puts a deeper nrder around that. It also takes the name and puts it on it. A sample of how it will look http://houghi.org/shots/slides/wppbr_scp_004_celebrities_elisha_cuthbert_02.php Now I don't expect people to be able to read the script, let alone understand it. I have not looked at it for a few years, so I probably would do it a bit different now. So again, use something else for the resize. Imagemagick is much easier and proably faster as well. Even the extra border I do with ImageMagick. I use fuzzy.pl Apparently the old maintainer does not have it on its website anymore so I just put it up. http://houghi.org/script/fuzzy.pl Go to "call the fuzzy border script with parameters" where you can change the parameters. For a different effect like http://houghi.org/shots/slides/Jessica6.php I use http://houghi.org/script/00_personal_scripts/wpm_photo Instead of the perl script, I directly use the GIMP batch mode. To make the 'photo' I need 3 parameters. The filename, the name of the image and the number of the photo. Simpel example: #!/bin/bash FILE=$1 NAME="Fuji Color" NUM=27 gimp --batch-interpreter plug-in-script-fu-eval -i -b '(batch-slide "'$FILE'" "'"$NAME"'" "'"$NUM"'")' -b '(gimp-quit 0)' The shadow effect is even easier. By this time the filename os temp.png gimp --batch-interpreter plug-in-script-fu-eval -i -b '(batch-drop-shadow "temp.png")' -b '(gimp-quit 0)' So basicaly it is build up as follows # first the part to call the script gimp --batch-interpreter plug-in-script-fu-eval -i -b '( # Next the name with batch in front of it, together with the parameters # you can edit batch-drop-shadow "temp.png" #Then the closing and ending of the batch call )' -b '(gimp-quit 0)' And let me repeat myself again. Look at ImagaMagick That can do a LOT for you much easier and faster then using Gimp in scriting. Use the best tool at the best moment. houghi -- Let's not be too tough on our own ignorance. It's the thing that makes America great. If America weren't incomparably ignorant, how could we have tolerated the last eight years? -- Frank Zappa, in 1988
Message-ID:<slrngdg38a.a47.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Mon, 22 Sep 2008 22:24:26 +0100
houghi wrote:
> http://houghi.org/script/fuzzy.pl
This does not seem to work anymore on my openSUSE 11.0. So I was trying
to put it in just like I did with the other things, but I get a lot of
errors.
I do:
gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
'(script-fuzzy-border file.jpg)' -b '(gimp-quit 0)'
All on one line. That gives me (almosy obviously) the error "batch
command: experienced an execution error." because I have not added the
correct parameters.
I have looked at http://www.lemur.com/dmm/culch/scriptsfu/index.html
I have looked in Xtns, Script Fu,. Script Fu Console
I have looked in
I have gone as far as
gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
'(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
\'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
0 0) TRUE TRUE )' -b "(gimp-quit 0)"
bash: syntax error near unexpected token `('
And then I started looking for the other things and some gave errors as
well:
houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
'(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
0)'
batch command: experienced an execution error.
Things that worked before stopped working (again)
This sucks heavily. For now each version of GIMP I had to re-invent the
wheel all over again. :-(
houghi
--
This was written under the influence of the following:
| Artist : Midnight Oil
| Song : The Dead Heart
| Album : Diesel and Dust
Message-ID:<48d9025d$1_1@news4us.nl>
Subject:
Re: making a script
Date:Tue, 23 Sep 2008 15:51:10 +0100
houghi wrote:
> houghi wrote:
>> http://houghi.org/script/fuzzy.pl
>
> This does not seem to work anymore on my openSUSE 11.0. So I was trying
> to put it in just like I did with the other things, but I get a lot of
> errors.
>
> I do:
> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
> '(script-fuzzy-border file.jpg)' -b '(gimp-quit 0)'
>
> All on one line. That gives me (almosy obviously) the error "batch
> command: experienced an execution error." because I have not added the
> correct parameters.
>
> I have looked at http://www.lemur.com/dmm/culch/scriptsfu/index.html
> I have looked in Xtns, Script Fu,. Script Fu Console
> I have looked in
>
> I have gone as far as
> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
> '(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
> \'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
> 0 0) TRUE TRUE )' -b "(gimp-quit 0)"
> bash: syntax error near unexpected token `('
>
> And then I started looking for the other things and some gave errors as
> well:
> houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
> '(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
> 0)'
> batch command: experienced an execution error.
>
> Things that worked before stopped working (again)
>
> This sucks heavily. For now each version of GIMP I had to re-invent the
> wheel all over again. :-(
>
> houghi
I sometimes use ImageMagick for screenshots, with EOG, but I like to
work with a graphic interface :(
Thnx for your answer
Message-ID:<slrngdi1gp.92m.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Tue, 23 Sep 2008 16:07:05 +0100
-=MrX=- wrote: > I sometimes use ImageMagick for screenshots, with EOG, but I like to > work with a graphic interface :( I use scripting to process several hundred of images. No way that I am able to do that one by one by hand. houghi -- All opinions are not equal. Some are a very great deal more robust, sophisticated and well supported in logic and argument than others.
Message-ID:<slrngdik3f.l7i.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Tue, 23 Sep 2008 21:24:15 +0100
houghi wrote:
> I have gone as far as
> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
> '(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
> \'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
> 0 0) TRUE TRUE )' -b "(gimp-quit 0)"
> bash: syntax error near unexpected token `('
>
> And then I started looking for the other things and some gave errors as
> well:
> houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
> '(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
> 0)'
> batch command: experienced an execution error.
I have now tried so many things with still the same non-result. Anybody
who can help us out? I have now wasted several hours on this and I am
getting nowhere. :-(
houghi
--
First we thought the PC was a calculator. Then we found out how to turn
numbers into letters with ASCII and we thought it was a typewriter. Then
we discovered graphics, and we thought it was television. With the World
Wide Web, we've realized it's a brochure. -- Douglas Adams.
Message-ID:<48da489f$1_5@news4us.nl>
Subject:
Re: making a script
Date:Wed, 24 Sep 2008 15:03:14 +0100
houghi wrote:
> houghi wrote:
>> I have gone as far as
>> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
>> '(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
>> \'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
>> 0 0) TRUE TRUE )' -b "(gimp-quit 0)"
>> bash: syntax error near unexpected token `('
>>
>> And then I started looking for the other things and some gave errors as
>> well:
>> houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
>> '(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
>> 0)'
>> batch command: experienced an execution error.
>
> I have now tried so many things with still the same non-result. Anybody
> who can help us out? I have now wasted several hours on this and I am
> getting nowhere. :-(
>
> houghi
So if I understand you well, ImageMagick is not the solution ?
Message-ID:<871vz8pen2.fld@apaflo.com>
Subject:
Re: making a script
Date:Thu, 25 Sep 2008 13:57:05 +0100
houghi <houghi@houghi.org.invalid> wrote: >In this I am using 'fuzzy-borders' as an example, not as a goal in >itself. That is why I started a new thread. > >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. > >However it does not seem to pick up the image. In fact wether the image >exists or not is irrelevant of the outcome. I have used gimp's batch processing only slightly, so I'm no expert on this. But there is at least one obvious problem, which quite general in scope too. 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.) 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. That could be done with prior -b options specifying one or more gimp functions that would accomplish whatever is required to have gimp in a state that allows 'script-fu-fuzzy-border' to work. Or, the most likely way to accomplish that is to write a separate script that calls all of the functions in order, and use that in the command line with the -b option rather than having -b options for each function needed. That is generally true of *every* function available via the batch processing. It is either a script written to be executed as a batch, or it needs one to be used. If I remember right there was mention in this thread previously of the best example available on the the WEB for how to do that, which is the one that does Unsharp Mask. In addition, the two Unsharp Mask example scripts for use in batch mode have another characteristic that needs to be addressed as part of the learning curve for writing batch mode scripts. The simple one is just that, too simple! It loads one file, applies USM, and writes the file back to disk. Two problems... you just lost your original file, and if the applied USM is not exactly correct, you had better have backup! That of course can be handled manually outside of the gimp script, but you do need to know about it and avoid working on unique image files that are not backed up. The second problem is that the script does only one file, and that means gimp must be loaded for every file the script is executed on, which makes it horribly slow for any number of files larger than a handful. Usually a large number of files is the exact reason a script is written, so that is an important deficit. What it means in simple terms is that the "simple" script is good for learning, but it is not of much value for production. The second variation, which will operate on multiple files as specified on the command line, is the one use as a starting point to build your own batch scripts. -- Floyd L. Davidson <http://www.apaflo.com/floyd_davidson> Ukpeagvik (Barrow, Alaska) floyd@apaflo.com
Message-ID:<slrngdo6sv.958.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 00:15:43 +0100
houghi wrote:
>> 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?
OK, I am again loosing several hours over this. I start with
http://www.gimp.org/tutorials/Basic_Batch/ and that works.
What I see there is absolutely no serious attempt to explain anything.
It is more a 'How to drive a car? You step in and drive away.' type of
thing. Pity to see that sch a thing where the GIMP could beat anything
is so neglected. :-( Anywah ..
I see two places where things are defined. The first is the define of
simple-unsharp-mask. The second is the plug-in-unsharp-mask.
Let me look at the first thing. There I see respectivaly filename,
radius, amount and threshold. Those are used as well in the commandline
with "foo.png" 5.0 0.5 0.
However when I look in Xtns, I see much more parameters. With a lot of
trial and error I was able to make a sharpen script that worked.
So I then try to re-write it for the fuzzy border and get to the
following:
(define (border-fuzz filename
color
value
toggle
value
toggle
value
toggle
toggle
)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename
filename)))
(drawable (car (gimp-image-get-active-layer image))))
(script-fu-fuzzy-border RUN-NONINTERACTIVE
image drawable
color
value
toggle
value
toggle
value
toggle
toggle
)
(set! drawable (car (gimp-image-get-active-layer image)))
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))
As command I give the following on one line:
gimp -i -b '(border-fuzz "foo.png" (0;0;0) 50 0 50 0 0 0 0)' -b
'(gimp-quit 0)'
It tells me it is successfull and nothing happens. I have no idea where
I am going wrong as there is no documentation available. I also doubt
that I am the only person in the world wjo wants to use gimp in a script
mode. So please can somebody show me what it must be instead of what I
have. No explanation, just the raw code. I can then try to fugure out
myself what I am doing wrong and apply it to other things.
I will then probably even write it all down for others to use.
houghi
--
The whole principle [of censorship] is wrong. It's like demanding that
grown men live on skim milk because the baby can't have steak.
-- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdpcua.mr0.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 11:04:58 +0100
Niels Giesen wrote: > Sorry, not giving the raw code, but code interspersed with comments. Great. Code would probably have been enough, but comments are nice to have as well. <snip as I do not use emacs and do not intend to learn it just to be able to run a script> > If you do not want to use that, in the development thereof, I have > searched the web, and found the following resources to be of use: > > http://docs.gimp.org/en/gimp-using-script-fu-tutorial.html > http://www.ve3syb.ca/wiki/doku.php?id=software:sf:start > http://mitpress.mit.edu/sicp/full-text/book/book.html > http://tech.groups.yahoo.com/group/script-fu/ I looked, but found not any example in running things from bash. I know the way my mind works might be at fault, but I am not very much able to use books (or man pages) to learn things from. If anything, the things above confused me more then showed me how to do things. The best way I learn things and especialy code is by copy and pasting and then change one thing and see what happens. Reverse engineering one might call it, others will notice how little kids learn that way as well. <snip> > Another way of debugging your scripts is turning tracing on, by issuing > (tracing TRUE), so, for instance: > > gimp -ic -b "(begin (tracing TRUE) (your code ... ) (gimp-quit RUN-NONINTERACTIVE))" > > and you can turn it off with (tracing FALSE). OK. This becomes interesting. <snip code> > From bash: > gimp -i -b "(begin (border-fuzz \"foo.png\" '(0 0 0) 50 0 16 FALSE 1 FALSE) (gimp-quit RUN-NONINTERACTIVE))" > > Hope this is of use. Very much so. I am now connected over ssh, so no GUI, but I will be checking this out this weekend. This is the information as it should have been presented on the docs. I will give feedback later on how things went. With your permission, I will put the information online as well. I willeven try to get it on docs.gimp.org if you allow me. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdpfv5.mr0.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 11:56:37 +0100
Giacomo Boffi wrote: > houghi <houghi@houghi.org.invalid> writes: > >> <snip as I do not use emacs and do not intend to learn it just to be >> able to run a script> > > in this case the purpose of using emacs is DEVELOPING a script - an > alternative to using emacs is convicing someone else to do our work I read the words, but I have no idea what you mean. First: what do you mean by "developing a script". Also why would I want someone else to do the work? I want to learn and understand it and be able not only to do 'fuzzy' but also be able to do all the other things that are available. In other words I want to learn to use gimp from the command line. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdqb0d.bev.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 19:38:05 +0100
Niels Giesen wrote: <snip> > From bash: > gimp -i -b "(begin (border-fuzz \"foo.png\" '(0 0 0) 50 0 16 FALSE 1 FALSE) (gimp-quit RUN-NONINTERACTIVE))" > > Hope this is of use. Just to confirm: it works great. Thanks. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<87d4irntyq.fld@apaflo.com>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 10:21:17 +0100
houghi <houghi@houghi.org.invalid> wrote:
>Floyd L. Davidson wrote:
>> houghi <houghi@houghi.org.invalid> 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@apaflo.com.
; Script-fu-fuzzy-border is defined in fuzzyborder.scm, which is
; copyright by Chris Gutteridge, cjg@ecs.soton.ac.uk.
;
; 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@apaflo.com
Message-ID:<slrngdpfm5.mr0.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 11:51:49 +0100
Floyd L. Davidson wrote: > 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. Then the 40.000+ wallpapers I have must not exist. Silly me. ;-) >>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. That is not how to do it. I indeed do have a problem comprehanding many things. >>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... Why? I think that is a rather eletist aproach and sounds as to blaming the student for not learning instead of blaming the teacher for not teaching. > Maybe you should compose music! :-) Nah, I stick to scripting. Some of the things I have done is used by amny thousands of people. I doubt that many people would ever be willing to listen to my musical skills. I know I don't. > Here's the script you need to batch process fuzzy borders. <snip> > ; 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)' <snip> Thanks, Great. I will try this out as well when I get home. Just one question. Instead of "pink" I should be able to use something like \'(100 100 100) right? houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdqgij.bev.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 21:13:07 +0100
Floyd L. Davidson wrote: <snip> > ; gimp -i -c -d -b '(batch_fuzzy_border "*.jpg" "pink" 40 \ > ; TRUE 10 TRUE 50 )' -b '(gimp-quit 0)' <snip> Just to confirm: works great. Together with the other posting I should be able to make other things work as well. Just to clarify: even though it is good to see how it is possible to use *.jpg, I won' be using it that way. What I do is first calculate the avareage color for an image and then I use that for the rest of the script. That means that even when I do a LOT of them in one run, each color and thus the gimp command line will be different. Anyway, thanks all. I can now concentrate on doing something like http://www.photoshopessentials.com/photo-effects/photo-borders-displace/ and other neat effects for wallpapers. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<20080923075800.366@usenet.piggo.com>
Subject:
Re: making a script
Date:Mon, 22 Sep 2008 23:00:12 +0100
* houghi wrote :
> -=MrX=- wrote:
>>
>> Hi
>>
>> I use Gimp just for 2 things.
>>
>> - resizing pictures to a standard format
>> - filters - decor - fuzzy border (each time same border)
>>
>> Can I make a script what does this for me ?
>
> Yes. Resizing is easier with ImageMagick.
<snip />
> And let me repeat myself again. Look at ImagaMagick That can do a LOT
> for you much easier and faster then using Gimp in scriting. Use the best
> tool at the best moment.
After you've resized for web with ImageMagick, do you sharpen?
I haven't used it for that yet. Does it have smart-sharpen type
capabilities?
--
Troy Piggins | http://piggo.com/~troy _ __ (_) __ _ __ _ ___
| '_ \| |/ _` |/ _` |/ _ \
| .__/|_|\__, |\__, |\___/
|_| |___/ |___/
Message-ID:<48d7cad5$1_5@news4us.nl>
Subject:
making a script
Date:Mon, 22 Sep 2008 17:41:57 +0100
Hi I use Gimp just for 2 things. - resizing pictures to a standard format - filters - decor - fuzzy border (each time same border) Can I make a script what does this for me ? tia Paulx
Message-ID:<slrngdfs1e.a47.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Mon, 22 Sep 2008 20:21:18 +0100
-=MrX=- wrote: > > > Hi > > I use Gimp just for 2 things. > > - resizing pictures to a standard format > - filters - decor - fuzzy border (each time same border) > > Can I make a script what does this for me ? Yes. Resizing is easier with ImageMagick. I use some scripting with the making of wallpapers. http://houghi.org/script/00_personal_scripts/wallpaper_maker does the following. It takes an image, makes it the right height, puts a fuzzy border around it and then puts a deeper nrder around that. It also takes the name and puts it on it. A sample of how it will look http://houghi.org/shots/slides/wppbr_scp_004_celebrities_elisha_cuthbert_02.php Now I don't expect people to be able to read the script, let alone understand it. I have not looked at it for a few years, so I probably would do it a bit different now. So again, use something else for the resize. Imagemagick is much easier and proably faster as well. Even the extra border I do with ImageMagick. I use fuzzy.pl Apparently the old maintainer does not have it on its website anymore so I just put it up. http://houghi.org/script/fuzzy.pl Go to "call the fuzzy border script with parameters" where you can change the parameters. For a different effect like http://houghi.org/shots/slides/Jessica6.php I use http://houghi.org/script/00_personal_scripts/wpm_photo Instead of the perl script, I directly use the GIMP batch mode. To make the 'photo' I need 3 parameters. The filename, the name of the image and the number of the photo. Simpel example: #!/bin/bash FILE=$1 NAME="Fuji Color" NUM=27 gimp --batch-interpreter plug-in-script-fu-eval -i -b '(batch-slide "'$FILE'" "'"$NAME"'" "'"$NUM"'")' -b '(gimp-quit 0)' The shadow effect is even easier. By this time the filename os temp.png gimp --batch-interpreter plug-in-script-fu-eval -i -b '(batch-drop-shadow "temp.png")' -b '(gimp-quit 0)' So basicaly it is build up as follows # first the part to call the script gimp --batch-interpreter plug-in-script-fu-eval -i -b '( # Next the name with batch in front of it, together with the parameters # you can edit batch-drop-shadow "temp.png" #Then the closing and ending of the batch call )' -b '(gimp-quit 0)' And let me repeat myself again. Look at ImagaMagick That can do a LOT for you much easier and faster then using Gimp in scriting. Use the best tool at the best moment. houghi -- Let's not be too tough on our own ignorance. It's the thing that makes America great. If America weren't incomparably ignorant, how could we have tolerated the last eight years? -- Frank Zappa, in 1988
Message-ID:<slrngdg38a.a47.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Mon, 22 Sep 2008 22:24:26 +0100
houghi wrote:
> http://houghi.org/script/fuzzy.pl
This does not seem to work anymore on my openSUSE 11.0. So I was trying
to put it in just like I did with the other things, but I get a lot of
errors.
I do:
gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
'(script-fuzzy-border file.jpg)' -b '(gimp-quit 0)'
All on one line. That gives me (almosy obviously) the error "batch
command: experienced an execution error." because I have not added the
correct parameters.
I have looked at http://www.lemur.com/dmm/culch/scriptsfu/index.html
I have looked in Xtns, Script Fu,. Script Fu Console
I have looked in
I have gone as far as
gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
'(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
\'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
0 0) TRUE TRUE )' -b "(gimp-quit 0)"
bash: syntax error near unexpected token `('
And then I started looking for the other things and some gave errors as
well:
houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
'(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
0)'
batch command: experienced an execution error.
Things that worked before stopped working (again)
This sucks heavily. For now each version of GIMP I had to re-invent the
wheel all over again. :-(
houghi
--
This was written under the influence of the following:
| Artist : Midnight Oil
| Song : The Dead Heart
| Album : Diesel and Dust
Message-ID:<48d9025d$1_1@news4us.nl>
Subject:
Re: making a script
Date:Tue, 23 Sep 2008 15:51:10 +0100
houghi wrote:
> houghi wrote:
>> http://houghi.org/script/fuzzy.pl
>
> This does not seem to work anymore on my openSUSE 11.0. So I was trying
> to put it in just like I did with the other things, but I get a lot of
> errors.
>
> I do:
> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
> '(script-fuzzy-border file.jpg)' -b '(gimp-quit 0)'
>
> All on one line. That gives me (almosy obviously) the error "batch
> command: experienced an execution error." because I have not added the
> correct parameters.
>
> I have looked at http://www.lemur.com/dmm/culch/scriptsfu/index.html
> I have looked in Xtns, Script Fu,. Script Fu Console
> I have looked in
>
> I have gone as far as
> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
> '(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
> \'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
> 0 0) TRUE TRUE )' -b "(gimp-quit 0)"
> bash: syntax error near unexpected token `('
>
> And then I started looking for the other things and some gave errors as
> well:
> houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
> '(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
> 0)'
> batch command: experienced an execution error.
>
> Things that worked before stopped working (again)
>
> This sucks heavily. For now each version of GIMP I had to re-invent the
> wheel all over again. :-(
>
> houghi
I sometimes use ImageMagick for screenshots, with EOG, but I like to
work with a graphic interface :(
Thnx for your answer
Message-ID:<slrngdi1gp.92m.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Tue, 23 Sep 2008 16:07:05 +0100
-=MrX=- wrote: > I sometimes use ImageMagick for screenshots, with EOG, but I like to > work with a graphic interface :( I use scripting to process several hundred of images. No way that I am able to do that one by one by hand. houghi -- All opinions are not equal. Some are a very great deal more robust, sophisticated and well supported in logic and argument than others.
Message-ID:<slrngdik3f.l7i.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Tue, 23 Sep 2008 21:24:15 +0100
houghi wrote:
> I have gone as far as
> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
> '(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
> \'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
> 0 0) TRUE TRUE )' -b "(gimp-quit 0)"
> bash: syntax error near unexpected token `('
>
> And then I started looking for the other things and some gave errors as
> well:
> houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
> '(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
> 0)'
> batch command: experienced an execution error.
I have now tried so many things with still the same non-result. Anybody
who can help us out? I have now wasted several hours on this and I am
getting nowhere. :-(
houghi
--
First we thought the PC was a calculator. Then we found out how to turn
numbers into letters with ASCII and we thought it was a typewriter. Then
we discovered graphics, and we thought it was television. With the World
Wide Web, we've realized it's a brochure. -- Douglas Adams.
Message-ID:<48da489f$1_5@news4us.nl>
Subject:
Re: making a script
Date:Wed, 24 Sep 2008 15:03:14 +0100
houghi wrote:
> houghi wrote:
>> I have gone as far as
>> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
>> '(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
>> \'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
>> 0 0) TRUE TRUE )' -b "(gimp-quit 0)"
>> bash: syntax error near unexpected token `('
>>
>> And then I started looking for the other things and some gave errors as
>> well:
>> houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
>> '(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
>> 0)'
>> batch command: experienced an execution error.
>
> I have now tried so many things with still the same non-result. Anybody
> who can help us out? I have now wasted several hours on this and I am
> getting nowhere. :-(
>
> houghi
So if I understand you well, ImageMagick is not the solution ?
Message-ID:<871vz8pen2.fld@apaflo.com>
Subject:
Re: making a script
Date:Thu, 25 Sep 2008 13:57:05 +0100
houghi <houghi@houghi.org.invalid> wrote: >In this I am using 'fuzzy-borders' as an example, not as a goal in >itself. That is why I started a new thread. > >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. > >However it does not seem to pick up the image. In fact wether the image >exists or not is irrelevant of the outcome. I have used gimp's batch processing only slightly, so I'm no expert on this. But there is at least one obvious problem, which quite general in scope too. 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.) 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. That could be done with prior -b options specifying one or more gimp functions that would accomplish whatever is required to have gimp in a state that allows 'script-fu-fuzzy-border' to work. Or, the most likely way to accomplish that is to write a separate script that calls all of the functions in order, and use that in the command line with the -b option rather than having -b options for each function needed. That is generally true of *every* function available via the batch processing. It is either a script written to be executed as a batch, or it needs one to be used. If I remember right there was mention in this thread previously of the best example available on the the WEB for how to do that, which is the one that does Unsharp Mask. In addition, the two Unsharp Mask example scripts for use in batch mode have another characteristic that needs to be addressed as part of the learning curve for writing batch mode scripts. The simple one is just that, too simple! It loads one file, applies USM, and writes the file back to disk. Two problems... you just lost your original file, and if the applied USM is not exactly correct, you had better have backup! That of course can be handled manually outside of the gimp script, but you do need to know about it and avoid working on unique image files that are not backed up. The second problem is that the script does only one file, and that means gimp must be loaded for every file the script is executed on, which makes it horribly slow for any number of files larger than a handful. Usually a large number of files is the exact reason a script is written, so that is an important deficit. What it means in simple terms is that the "simple" script is good for learning, but it is not of much value for production. The second variation, which will operate on multiple files as specified on the command line, is the one use as a starting point to build your own batch scripts. -- Floyd L. Davidson <http://www.apaflo.com/floyd_davidson> Ukpeagvik (Barrow, Alaska) floyd@apaflo.com
Message-ID:<slrngdo6sv.958.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 00:15:43 +0100
houghi wrote:
>> 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?
OK, I am again loosing several hours over this. I start with
http://www.gimp.org/tutorials/Basic_Batch/ and that works.
What I see there is absolutely no serious attempt to explain anything.
It is more a 'How to drive a car? You step in and drive away.' type of
thing. Pity to see that sch a thing where the GIMP could beat anything
is so neglected. :-( Anywah ..
I see two places where things are defined. The first is the define of
simple-unsharp-mask. The second is the plug-in-unsharp-mask.
Let me look at the first thing. There I see respectivaly filename,
radius, amount and threshold. Those are used as well in the commandline
with "foo.png" 5.0 0.5 0.
However when I look in Xtns, I see much more parameters. With a lot of
trial and error I was able to make a sharpen script that worked.
So I then try to re-write it for the fuzzy border and get to the
following:
(define (border-fuzz filename
color
value
toggle
value
toggle
value
toggle
toggle
)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename
filename)))
(drawable (car (gimp-image-get-active-layer image))))
(script-fu-fuzzy-border RUN-NONINTERACTIVE
image drawable
color
value
toggle
value
toggle
value
toggle
toggle
)
(set! drawable (car (gimp-image-get-active-layer image)))
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))
As command I give the following on one line:
gimp -i -b '(border-fuzz "foo.png" (0;0;0) 50 0 50 0 0 0 0)' -b
'(gimp-quit 0)'
It tells me it is successfull and nothing happens. I have no idea where
I am going wrong as there is no documentation available. I also doubt
that I am the only person in the world wjo wants to use gimp in a script
mode. So please can somebody show me what it must be instead of what I
have. No explanation, just the raw code. I can then try to fugure out
myself what I am doing wrong and apply it to other things.
I will then probably even write it all down for others to use.
houghi
--
The whole principle [of censorship] is wrong. It's like demanding that
grown men live on skim milk because the baby can't have steak.
-- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdpcua.mr0.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 11:04:58 +0100
Niels Giesen wrote: > Sorry, not giving the raw code, but code interspersed with comments. Great. Code would probably have been enough, but comments are nice to have as well. <snip as I do not use emacs and do not intend to learn it just to be able to run a script> > If you do not want to use that, in the development thereof, I have > searched the web, and found the following resources to be of use: > > http://docs.gimp.org/en/gimp-using-script-fu-tutorial.html > http://www.ve3syb.ca/wiki/doku.php?id=software:sf:start > http://mitpress.mit.edu/sicp/full-text/book/book.html > http://tech.groups.yahoo.com/group/script-fu/ I looked, but found not any example in running things from bash. I know the way my mind works might be at fault, but I am not very much able to use books (or man pages) to learn things from. If anything, the things above confused me more then showed me how to do things. The best way I learn things and especialy code is by copy and pasting and then change one thing and see what happens. Reverse engineering one might call it, others will notice how little kids learn that way as well. <snip> > Another way of debugging your scripts is turning tracing on, by issuing > (tracing TRUE), so, for instance: > > gimp -ic -b "(begin (tracing TRUE) (your code ... ) (gimp-quit RUN-NONINTERACTIVE))" > > and you can turn it off with (tracing FALSE). OK. This becomes interesting. <snip code> > From bash: > gimp -i -b "(begin (border-fuzz \"foo.png\" '(0 0 0) 50 0 16 FALSE 1 FALSE) (gimp-quit RUN-NONINTERACTIVE))" > > Hope this is of use. Very much so. I am now connected over ssh, so no GUI, but I will be checking this out this weekend. This is the information as it should have been presented on the docs. I will give feedback later on how things went. With your permission, I will put the information online as well. I willeven try to get it on docs.gimp.org if you allow me. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdpfv5.mr0.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 11:56:37 +0100
Giacomo Boffi wrote: > houghi <houghi@houghi.org.invalid> writes: > >> <snip as I do not use emacs and do not intend to learn it just to be >> able to run a script> > > in this case the purpose of using emacs is DEVELOPING a script - an > alternative to using emacs is convicing someone else to do our work I read the words, but I have no idea what you mean. First: what do you mean by "developing a script". Also why would I want someone else to do the work? I want to learn and understand it and be able not only to do 'fuzzy' but also be able to do all the other things that are available. In other words I want to learn to use gimp from the command line. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdqb0d.bev.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 19:38:05 +0100
Niels Giesen wrote: <snip> > From bash: > gimp -i -b "(begin (border-fuzz \"foo.png\" '(0 0 0) 50 0 16 FALSE 1 FALSE) (gimp-quit RUN-NONINTERACTIVE))" > > Hope this is of use. Just to confirm: it works great. Thanks. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<87d4irntyq.fld@apaflo.com>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 10:21:17 +0100
houghi <houghi@houghi.org.invalid> wrote:
>Floyd L. Davidson wrote:
>> houghi <houghi@houghi.org.invalid> 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@apaflo.com.
; Script-fu-fuzzy-border is defined in fuzzyborder.scm, which is
; copyright by Chris Gutteridge, cjg@ecs.soton.ac.uk.
;
; 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@apaflo.com
Message-ID:<slrngdpfm5.mr0.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 11:51:49 +0100
Floyd L. Davidson wrote: > 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. Then the 40.000+ wallpapers I have must not exist. Silly me. ;-) >>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. That is not how to do it. I indeed do have a problem comprehanding many things. >>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... Why? I think that is a rather eletist aproach and sounds as to blaming the student for not learning instead of blaming the teacher for not teaching. > Maybe you should compose music! :-) Nah, I stick to scripting. Some of the things I have done is used by amny thousands of people. I doubt that many people would ever be willing to listen to my musical skills. I know I don't. > Here's the script you need to batch process fuzzy borders. <snip> > ; 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)' <snip> Thanks, Great. I will try this out as well when I get home. Just one question. Instead of "pink" I should be able to use something like \'(100 100 100) right? houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdqgij.bev.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 21:13:07 +0100
Floyd L. Davidson wrote: <snip> > ; gimp -i -c -d -b '(batch_fuzzy_border "*.jpg" "pink" 40 \ > ; TRUE 10 TRUE 50 )' -b '(gimp-quit 0)' <snip> Just to confirm: works great. Together with the other posting I should be able to make other things work as well. Just to clarify: even though it is good to see how it is possible to use *.jpg, I won' be using it that way. What I do is first calculate the avareage color for an image and then I use that for the rest of the script. That means that even when I do a LOT of them in one run, each color and thus the gimp command line will be different. Anyway, thanks all. I can now concentrate on doing something like http://www.photoshopessentials.com/photo-effects/photo-borders-displace/ and other neat effects for wallpapers. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<20080923075800.366@usenet.piggo.com>
Subject:
Re: making a script
Date:Mon, 22 Sep 2008 23:00:12 +0100
* houghi wrote :
> -=MrX=- wrote:
>>
>> Hi
>>
>> I use Gimp just for 2 things.
>>
>> - resizing pictures to a standard format
>> - filters - decor - fuzzy border (each time same border)
>>
>> Can I make a script what does this for me ?
>
> Yes. Resizing is easier with ImageMagick.
<snip />
> And let me repeat myself again. Look at ImagaMagick That can do a LOT
> for you much easier and faster then using Gimp in scriting. Use the best
> tool at the best moment.
After you've resized for web with ImageMagick, do you sharpen?
I haven't used it for that yet. Does it have smart-sharpen type
capabilities?
--
Troy Piggins | http://piggo.com/~troy _ __ (_) __ _ __ _ ___
| '_ \| |/ _` |/ _` |/ _ \
| .__/|_|\__, |\__, |\___/
|_| |___/ |___/
Message-ID:<48d7cad5$1_5@news4us.nl>
Subject:
making a script
Date:Mon, 22 Sep 2008 17:41:57 +0100
Hi I use Gimp just for 2 things. - resizing pictures to a standard format - filters - decor - fuzzy border (each time same border) Can I make a script what does this for me ? tia Paulx
Message-ID:<slrngdfs1e.a47.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Mon, 22 Sep 2008 20:21:18 +0100
-=MrX=- wrote: > > > Hi > > I use Gimp just for 2 things. > > - resizing pictures to a standard format > - filters - decor - fuzzy border (each time same border) > > Can I make a script what does this for me ? Yes. Resizing is easier with ImageMagick. I use some scripting with the making of wallpapers. http://houghi.org/script/00_personal_scripts/wallpaper_maker does the following. It takes an image, makes it the right height, puts a fuzzy border around it and then puts a deeper nrder around that. It also takes the name and puts it on it. A sample of how it will look http://houghi.org/shots/slides/wppbr_scp_004_celebrities_elisha_cuthbert_02.php Now I don't expect people to be able to read the script, let alone understand it. I have not looked at it for a few years, so I probably would do it a bit different now. So again, use something else for the resize. Imagemagick is much easier and proably faster as well. Even the extra border I do with ImageMagick. I use fuzzy.pl Apparently the old maintainer does not have it on its website anymore so I just put it up. http://houghi.org/script/fuzzy.pl Go to "call the fuzzy border script with parameters" where you can change the parameters. For a different effect like http://houghi.org/shots/slides/Jessica6.php I use http://houghi.org/script/00_personal_scripts/wpm_photo Instead of the perl script, I directly use the GIMP batch mode. To make the 'photo' I need 3 parameters. The filename, the name of the image and the number of the photo. Simpel example: #!/bin/bash FILE=$1 NAME="Fuji Color" NUM=27 gimp --batch-interpreter plug-in-script-fu-eval -i -b '(batch-slide "'$FILE'" "'"$NAME"'" "'"$NUM"'")' -b '(gimp-quit 0)' The shadow effect is even easier. By this time the filename os temp.png gimp --batch-interpreter plug-in-script-fu-eval -i -b '(batch-drop-shadow "temp.png")' -b '(gimp-quit 0)' So basicaly it is build up as follows # first the part to call the script gimp --batch-interpreter plug-in-script-fu-eval -i -b '( # Next the name with batch in front of it, together with the parameters # you can edit batch-drop-shadow "temp.png" #Then the closing and ending of the batch call )' -b '(gimp-quit 0)' And let me repeat myself again. Look at ImagaMagick That can do a LOT for you much easier and faster then using Gimp in scriting. Use the best tool at the best moment. houghi -- Let's not be too tough on our own ignorance. It's the thing that makes America great. If America weren't incomparably ignorant, how could we have tolerated the last eight years? -- Frank Zappa, in 1988
Message-ID:<slrngdg38a.a47.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Mon, 22 Sep 2008 22:24:26 +0100
houghi wrote:
> http://houghi.org/script/fuzzy.pl
This does not seem to work anymore on my openSUSE 11.0. So I was trying
to put it in just like I did with the other things, but I get a lot of
errors.
I do:
gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
'(script-fuzzy-border file.jpg)' -b '(gimp-quit 0)'
All on one line. That gives me (almosy obviously) the error "batch
command: experienced an execution error." because I have not added the
correct parameters.
I have looked at http://www.lemur.com/dmm/culch/scriptsfu/index.html
I have looked in Xtns, Script Fu,. Script Fu Console
I have looked in
I have gone as far as
gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
'(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
\'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
0 0) TRUE TRUE )' -b "(gimp-quit 0)"
bash: syntax error near unexpected token `('
And then I started looking for the other things and some gave errors as
well:
houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
'(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
0)'
batch command: experienced an execution error.
Things that worked before stopped working (again)
This sucks heavily. For now each version of GIMP I had to re-invent the
wheel all over again. :-(
houghi
--
This was written under the influence of the following:
| Artist : Midnight Oil
| Song : The Dead Heart
| Album : Diesel and Dust
Message-ID:<48d9025d$1_1@news4us.nl>
Subject:
Re: making a script
Date:Tue, 23 Sep 2008 15:51:10 +0100
houghi wrote:
> houghi wrote:
>> http://houghi.org/script/fuzzy.pl
>
> This does not seem to work anymore on my openSUSE 11.0. So I was trying
> to put it in just like I did with the other things, but I get a lot of
> errors.
>
> I do:
> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
> '(script-fuzzy-border file.jpg)' -b '(gimp-quit 0)'
>
> All on one line. That gives me (almosy obviously) the error "batch
> command: experienced an execution error." because I have not added the
> correct parameters.
>
> I have looked at http://www.lemur.com/dmm/culch/scriptsfu/index.html
> I have looked in Xtns, Script Fu,. Script Fu Console
> I have looked in
>
> I have gone as far as
> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
> '(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
> \'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
> 0 0) TRUE TRUE )' -b "(gimp-quit 0)"
> bash: syntax error near unexpected token `('
>
> And then I started looking for the other things and some gave errors as
> well:
> houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
> '(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
> 0)'
> batch command: experienced an execution error.
>
> Things that worked before stopped working (again)
>
> This sucks heavily. For now each version of GIMP I had to re-invent the
> wheel all over again. :-(
>
> houghi
I sometimes use ImageMagick for screenshots, with EOG, but I like to
work with a graphic interface :(
Thnx for your answer
Message-ID:<slrngdi1gp.92m.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Tue, 23 Sep 2008 16:07:05 +0100
-=MrX=- wrote: > I sometimes use ImageMagick for screenshots, with EOG, but I like to > work with a graphic interface :( I use scripting to process several hundred of images. No way that I am able to do that one by one by hand. houghi -- All opinions are not equal. Some are a very great deal more robust, sophisticated and well supported in logic and argument than others.
Message-ID:<slrngdik3f.l7i.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Tue, 23 Sep 2008 21:24:15 +0100
houghi wrote:
> I have gone as far as
> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
> '(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
> \'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
> 0 0) TRUE TRUE )' -b "(gimp-quit 0)"
> bash: syntax error near unexpected token `('
>
> And then I started looking for the other things and some gave errors as
> well:
> houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
> '(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
> 0)'
> batch command: experienced an execution error.
I have now tried so many things with still the same non-result. Anybody
who can help us out? I have now wasted several hours on this and I am
getting nowhere. :-(
houghi
--
First we thought the PC was a calculator. Then we found out how to turn
numbers into letters with ASCII and we thought it was a typewriter. Then
we discovered graphics, and we thought it was television. With the World
Wide Web, we've realized it's a brochure. -- Douglas Adams.
Message-ID:<48da489f$1_5@news4us.nl>
Subject:
Re: making a script
Date:Wed, 24 Sep 2008 15:03:14 +0100
houghi wrote:
> houghi wrote:
>> I have gone as far as
>> gimp --batch-interpreter plug-in-script-fu-eval -i -d -b
>> '(script-fuzzy-border heidi_hanson_20080921_0155.jpg 0 \'(255 255 255)
>> \'(16 1 200 1 10 0 1) TRUE \'(4 1 16 0.25 5 2 0) FALSE \'(100 0 100 1 10
>> 0 0) TRUE TRUE )' -b "(gimp-quit 0)"
>> bash: syntax error near unexpected token `('
>>
>> And then I started looking for the other things and some gave errors as
>> well:
>> houghi@pasta : gimp --batch-interpreter plug-in-script-fu-eval -i -b
>> '(batch-drop-shadow "heidi_hanson_20080921_0155.jpg")' -b '(gimp-quit
>> 0)'
>> batch command: experienced an execution error.
>
> I have now tried so many things with still the same non-result. Anybody
> who can help us out? I have now wasted several hours on this and I am
> getting nowhere. :-(
>
> houghi
So if I understand you well, ImageMagick is not the solution ?
Message-ID:<871vz8pen2.fld@apaflo.com>
Subject:
Re: making a script
Date:Thu, 25 Sep 2008 13:57:05 +0100
houghi <houghi@houghi.org.invalid> wrote: >In this I am using 'fuzzy-borders' as an example, not as a goal in >itself. That is why I started a new thread. > >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. > >However it does not seem to pick up the image. In fact wether the image >exists or not is irrelevant of the outcome. I have used gimp's batch processing only slightly, so I'm no expert on this. But there is at least one obvious problem, which quite general in scope too. 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.) 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. That could be done with prior -b options specifying one or more gimp functions that would accomplish whatever is required to have gimp in a state that allows 'script-fu-fuzzy-border' to work. Or, the most likely way to accomplish that is to write a separate script that calls all of the functions in order, and use that in the command line with the -b option rather than having -b options for each function needed. That is generally true of *every* function available via the batch processing. It is either a script written to be executed as a batch, or it needs one to be used. If I remember right there was mention in this thread previously of the best example available on the the WEB for how to do that, which is the one that does Unsharp Mask. In addition, the two Unsharp Mask example scripts for use in batch mode have another characteristic that needs to be addressed as part of the learning curve for writing batch mode scripts. The simple one is just that, too simple! It loads one file, applies USM, and writes the file back to disk. Two problems... you just lost your original file, and if the applied USM is not exactly correct, you had better have backup! That of course can be handled manually outside of the gimp script, but you do need to know about it and avoid working on unique image files that are not backed up. The second problem is that the script does only one file, and that means gimp must be loaded for every file the script is executed on, which makes it horribly slow for any number of files larger than a handful. Usually a large number of files is the exact reason a script is written, so that is an important deficit. What it means in simple terms is that the "simple" script is good for learning, but it is not of much value for production. The second variation, which will operate on multiple files as specified on the command line, is the one use as a starting point to build your own batch scripts. -- Floyd L. Davidson <http://www.apaflo.com/floyd_davidson> Ukpeagvik (Barrow, Alaska) floyd@apaflo.com
Message-ID:<slrngdo6sv.958.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 00:15:43 +0100
houghi wrote:
>> 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?
OK, I am again loosing several hours over this. I start with
http://www.gimp.org/tutorials/Basic_Batch/ and that works.
What I see there is absolutely no serious attempt to explain anything.
It is more a 'How to drive a car? You step in and drive away.' type of
thing. Pity to see that sch a thing where the GIMP could beat anything
is so neglected. :-( Anywah ..
I see two places where things are defined. The first is the define of
simple-unsharp-mask. The second is the plug-in-unsharp-mask.
Let me look at the first thing. There I see respectivaly filename,
radius, amount and threshold. Those are used as well in the commandline
with "foo.png" 5.0 0.5 0.
However when I look in Xtns, I see much more parameters. With a lot of
trial and error I was able to make a sharpen script that worked.
So I then try to re-write it for the fuzzy border and get to the
following:
(define (border-fuzz filename
color
value
toggle
value
toggle
value
toggle
toggle
)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename
filename)))
(drawable (car (gimp-image-get-active-layer image))))
(script-fu-fuzzy-border RUN-NONINTERACTIVE
image drawable
color
value
toggle
value
toggle
value
toggle
toggle
)
(set! drawable (car (gimp-image-get-active-layer image)))
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))
As command I give the following on one line:
gimp -i -b '(border-fuzz "foo.png" (0;0;0) 50 0 50 0 0 0 0)' -b
'(gimp-quit 0)'
It tells me it is successfull and nothing happens. I have no idea where
I am going wrong as there is no documentation available. I also doubt
that I am the only person in the world wjo wants to use gimp in a script
mode. So please can somebody show me what it must be instead of what I
have. No explanation, just the raw code. I can then try to fugure out
myself what I am doing wrong and apply it to other things.
I will then probably even write it all down for others to use.
houghi
--
The whole principle [of censorship] is wrong. It's like demanding that
grown men live on skim milk because the baby can't have steak.
-- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdpcua.mr0.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 11:04:58 +0100
Niels Giesen wrote: > Sorry, not giving the raw code, but code interspersed with comments. Great. Code would probably have been enough, but comments are nice to have as well. <snip as I do not use emacs and do not intend to learn it just to be able to run a script> > If you do not want to use that, in the development thereof, I have > searched the web, and found the following resources to be of use: > > http://docs.gimp.org/en/gimp-using-script-fu-tutorial.html > http://www.ve3syb.ca/wiki/doku.php?id=software:sf:start > http://mitpress.mit.edu/sicp/full-text/book/book.html > http://tech.groups.yahoo.com/group/script-fu/ I looked, but found not any example in running things from bash. I know the way my mind works might be at fault, but I am not very much able to use books (or man pages) to learn things from. If anything, the things above confused me more then showed me how to do things. The best way I learn things and especialy code is by copy and pasting and then change one thing and see what happens. Reverse engineering one might call it, others will notice how little kids learn that way as well. <snip> > Another way of debugging your scripts is turning tracing on, by issuing > (tracing TRUE), so, for instance: > > gimp -ic -b "(begin (tracing TRUE) (your code ... ) (gimp-quit RUN-NONINTERACTIVE))" > > and you can turn it off with (tracing FALSE). OK. This becomes interesting. <snip code> > From bash: > gimp -i -b "(begin (border-fuzz \"foo.png\" '(0 0 0) 50 0 16 FALSE 1 FALSE) (gimp-quit RUN-NONINTERACTIVE))" > > Hope this is of use. Very much so. I am now connected over ssh, so no GUI, but I will be checking this out this weekend. This is the information as it should have been presented on the docs. I will give feedback later on how things went. With your permission, I will put the information online as well. I willeven try to get it on docs.gimp.org if you allow me. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdpfv5.mr0.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 11:56:37 +0100
Giacomo Boffi wrote: > houghi <houghi@houghi.org.invalid> writes: > >> <snip as I do not use emacs and do not intend to learn it just to be >> able to run a script> > > in this case the purpose of using emacs is DEVELOPING a script - an > alternative to using emacs is convicing someone else to do our work I read the words, but I have no idea what you mean. First: what do you mean by "developing a script". Also why would I want someone else to do the work? I want to learn and understand it and be able not only to do 'fuzzy' but also be able to do all the other things that are available. In other words I want to learn to use gimp from the command line. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdqb0d.bev.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 19:38:05 +0100
Niels Giesen wrote: <snip> > From bash: > gimp -i -b "(begin (border-fuzz \"foo.png\" '(0 0 0) 50 0 16 FALSE 1 FALSE) (gimp-quit RUN-NONINTERACTIVE))" > > Hope this is of use. Just to confirm: it works great. Thanks. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<87d4irntyq.fld@apaflo.com>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 10:21:17 +0100
houghi <houghi@houghi.org.invalid> wrote:
>Floyd L. Davidson wrote:
>> houghi <houghi@houghi.org.invalid> 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@apaflo.com.
; Script-fu-fuzzy-border is defined in fuzzyborder.scm, which is
; copyright by Chris Gutteridge, cjg@ecs.soton.ac.uk.
;
; 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@apaflo.com
Message-ID:<slrngdpfm5.mr0.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 11:51:49 +0100
Floyd L. Davidson wrote: > 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. Then the 40.000+ wallpapers I have must not exist. Silly me. ;-) >>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. That is not how to do it. I indeed do have a problem comprehanding many things. >>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... Why? I think that is a rather eletist aproach and sounds as to blaming the student for not learning instead of blaming the teacher for not teaching. > Maybe you should compose music! :-) Nah, I stick to scripting. Some of the things I have done is used by amny thousands of people. I doubt that many people would ever be willing to listen to my musical skills. I know I don't. > Here's the script you need to batch process fuzzy borders. <snip> > ; 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)' <snip> Thanks, Great. I will try this out as well when I get home. Just one question. Instead of "pink" I should be able to use something like \'(100 100 100) right? houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<slrngdqgij.bev.houghi@pasta.houghi>
Subject:
Re: making a script
Date:Fri, 26 Sep 2008 21:13:07 +0100
Floyd L. Davidson wrote: <snip> > ; gimp -i -c -d -b '(batch_fuzzy_border "*.jpg" "pink" 40 \ > ; TRUE 10 TRUE 50 )' -b '(gimp-quit 0)' <snip> Just to confirm: works great. Together with the other posting I should be able to make other things work as well. Just to clarify: even though it is good to see how it is possible to use *.jpg, I won' be using it that way. What I do is first calculate the avareage color for an image and then I use that for the rest of the script. That means that even when I do a LOT of them in one run, each color and thus the gimp command line will be different. Anyway, thanks all. I can now concentrate on doing something like http://www.photoshopessentials.com/photo-effects/photo-borders-displace/ and other neat effects for wallpapers. houghi -- The whole principle [of censorship] is wrong. It's like demanding that grown men live on skim milk because the baby can't have steak. -- Robert A. Heinlein in "The Man Who Sold the Moon"
Message-ID:<20080923075800.366@usenet.piggo.com>
Subject:
Re: making a script
Date:Mon, 22 Sep 2008 23:00:12 +0100
* houghi wrote :
> -=MrX=- wrote:
>>
>> Hi
>>
>> I use Gimp just for 2 things.
>>
>> - resizing pictures to a standard format
>> - filters - decor - fuzzy border (each time same border)
>>
>> Can I make a script what does this for me ?
>
> Yes. Resizing is easier with ImageMagick.
<snip />
> And let me repeat myself again. Look at ImagaMagick That can do a LOT
> for you much easier and faster then using Gimp in scriting. Use the best
> tool at the best moment.
After you've resized for web with ImageMagick, do you sharpen?
I haven't used it for that yet. Does it have smart-sharpen type
capabilities?
--
Troy Piggins | http://piggo.com/~troy _ __ (_) __ _ __ _ ___
| '_ \| |/ _` |/ _` |/ _ \
| .__/|_|\__, |\__, |\___/
|_| |___/ |___/



RSS News Feed