[Gimp-user] whats the best way to learn script-fu
David Gowers
00ai99 at gmail.com
Wed Apr 2 04:06:43 PDT 2008
On Wed, Apr 2, 2008 at 9:59 PM, rob <roomberg at ptd.net> 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", "", "", "", "", "",
"<Toolbox>/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!
More information about the Gimp-user
mailing list