whats the best way to learn script-fu
This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
whats the best way to learn script-fu | rob | 02 Apr 13:29 |
whats the best way to learn script-fu | David Gowers | 02 Apr 13:06 |
whats the best way to learn script-fu | Sven Neumann | 02 Apr 20:45 |
whats the best way to learn script-fu | Man Max | 03 Apr 14:40 |
whats the best way to learn script-fu | Kevin Cozens | 04 Apr 20:52 |
whats the best way to learn script-fu
On Wed, Apr 2, 2008 at 9:59 PM, rob wrote:
Whats the best way to learn script-fu? Is there a good online tutorial? A book? Seems to be a ton of instruction material on the web and I was wondering if anyone can recomend something specific that they thought was the best way to get started with batch image processing with gimp.
Yes. Learn Python instead, as Python, since GIMP 2.4+, is the preferred scripting language for gimp plugins, and it is far more approachable than script-fu, unless you have LISP/Scheme experience. . If you don't like that idea, or you cannot guarantee that your users will all be using 2.4 with Python support, you could visit http://www.gimptalk.com/forum/forum/GIMP-Plugins-Filters-and-Scripts-9-1.html since there is a script-fu there that does batch resizing -- you could modify it to do batch [whatever you want] or just study it.
If you do like that idea,
http://www.diveintopython.org
is a great way to get started with Python, and
http://blenderartists.org/forum/archive/index.php/t-84073.html
provides an example batch processing python script which I will quote here, since it's not correctly indented there:
#! /usr/bin/env python
from gimpfu import * import glob
def batch_unsharp_mask( file_pattern, radius, amount, threshold ):
file_list=glob.glob(file_pattern)
file_list.sort()
for file_name in file_list:
image = pdb.gimp_file_load(file_name, file_name)
drawable = pdb.gimp_image_get_active_layer(image)
pdb.plug_in_unsharp_mask(image, drawable, radius, amount, threshold)
pdb.gimp_file_save(image, drawable, file_name, file_name)
pdb.gimp_image_delete(image)
register(
"batch_unsharp_mask", "", "", "", "", "",
"/Xtns/Languages/Python-Fu/Test/_Batch Unsharp Mask", "",
[
(PF_STRING, "file_pattern", "file_pattern", "*.png"),
(PF_FLOAT, "radius", "Radius", 5.0 ),
(PF_FLOAT, "amount", "Amount", 0.5 ),
(PF_INT32, "threshold", "Threshold", 0 )
],
[],
batch_unsharp_mask
)
main()
The 'gimptalk' link I gave also has a guide to getting GIMP-Python working in windows. If you're using Linux, it's probably already working and available :)
After learning python, http://www.gimp.org/docs/python/index.html can provide you the details of how the GIMP API works in python.
Hope that helps!
whats the best way to learn script-fu
Whats the best way to learn script-fu? Is there a good online tutorial? A book? Seems to be a ton of instruction material on the web and I was wondering if anyone can recomend something specific that they thought was the best way to get started with batch image processing with gimp.
whats the best way to learn script-fu
Hi,
On Wed, 2008-04-02 at 21:36 +1030, David Gowers wrote:
register(
"batch_unsharp_mask", "", "", "", "", "", "/Xtns/Languages/Python-Fu/Test/_Batch Unsharp Mask", "", [
(PF_STRING, "file_pattern", "file_pattern", "*.png"), (PF_FLOAT, "radius", "Radius", 5.0 ), (PF_FLOAT, "amount", "Amount", 0.5 ), (PF_INT32, "threshold", "Threshold", 0 ) ],
[],
batch_unsharp_mask
)
It would be so much nicer if example scripts like this one would use the new register API instead of the deprecated one that is being used here. Please use this instead:
register(
"batch-unsharp-mask", "", "", "", "", "",
"_Batch Unsharp Mask", "",
[
(PF_STRING, "file-pattern", "File Pattern", "*.png"),
(PF_FLOAT, "radius", "Radius", 5.0 ),
(PF_FLOAT, "amount", "Amount", 0.5 ),
(PF_INT32, "threshold", "Threshold", 0 )
],
[],
batch_unsharp_mask,
menu="/Xtns/Languages/Python-Fu/Test"
)
Sven
whats the best way to learn script-fu
Hello,
You could try python_fu language it's seem easier than scheme because of
scheme need a lot of ((((())))))))
Python manage indentation
it's just my opinion And after......you could find by google some exemple good luck
2008/4/2, rob :
Whats the best way to learn script-fu? Is there a good online tutorial? A book? Seems to be a ton of instruction material on the web and I was wondering if anyone can recomend something specific that they thought was the best way to get started with batch image processing with gimp.
_______________________________________________ Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
whats the best way to learn script-fu
rob wrote:
Whats the best way to learn script-fu?
[snip]
if anyone can recomend something specific that they thought was the best way to get started with batch image processing with gimp.
You should become familiar with the Scheme language. To do that, get a copy of the R5RS (http://www.schemers.org/Documents/Standards/R5RS/r5rs.pdf) and read it. Just be aware that not everything mentioned in the R5RS is implemented in the Scheme interpreter of Script-Fu. Items like define-syntax, or bignums are examples of items not currently supported. Also, look at the scripts which are shipped with GIMP.
I think one of the problems people have when learning Scheme is that a lot of scripts are shown with many closing ) symbols at the end of a line. While you are getting comfortable with Scheme I would suggest you don't skimp on the whitespace. Put the closing parentheses on separate lines. If may violate some Scheme based coding style guides but makes it much easier to see the syntax of the language.
There are tutorials on the GIMP web site at http://www.gimp.org/tutorials/ under "Script Authoring". I also have some notes about Script-Fu in the wiki section of my web site at http://www.ve3syb.ca/wiki/doku.php?id=software:sf:start
Be careful of any Script-Fu tutorial which was written before the release of the 2.4 version of GIMP. It may contain information that is out-of-date or even wrong as GIMP has moved to a different Scheme interpreter.