Re: [Gimp-user] batch mode in gimp, add alpha, change color

Top Page

Reply to this message
Author: Joao S. O. Bueno
Date:  
To: gimp-user
Subject: Re: [Gimp-user] batch mode in gimp, add alpha, change color
On Thursday 01 May 2008, Choi, JiHui wrote:
> I tried to learn scheme, but it's so difficult.

Indeed!

> and if I want another actions, I have to learn about relative
> functions. so I think, I just want to use gimp, not to learn
> scheme. I don't know and don't have any interesting about scheme.
>
> humm.. anyway.. to learn scheme is the only way?
> Isn't there something better than DBP plugin?


No. Scehme is nto the only way. Nowadays you can do your script using
python - which is a much better language in several terms.

You still use the PDB for some (even most) actions, but calling then
from python makes a mucheasier to read and write program.

For operating on all images in a given dir,just do:
import os
from gimpfu import *
def do_it (givendir):
for filename in os.listdir(givendir):
    pdb.gimp_file_open(filename, filename)
    layer = image.layers[0]
    layer.add_alpha()
    pdb.gimp_by_color_select(drw, "#fff", 0, CHANNEL_OP_REPLACE, True, 0,
0, False)
    pdb.gimp_edit_cut(layer)
    pdb.gimp_file_save(image, filename, filename)
pdb.gimp_image_delete(image)

Followed by the "register" and "main" boilerplate code you can copy
from any other python plug-in (there are a couple bundled with
gimp-python install) - the "givendir" variable will be automatically
inputed from a generated interface - you can use PF_DIR or PF_STRING
for inputing it. (or even hard code it if you are running this only
once)

For running gimp-python in windows, you need to install the Python
language (from www.python.org), python-cairo and python-gtk+ bidings
(I think just these).

    js
    -><-
_______________________________________________
Gimp-user mailing list
Gimp-user@???
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user