batch mode in gimp, add alpha, change color

View: New views
7 Messages — Rating Filter:   Alert me  

batch mode in gimp, add alpha, change color

by Choi, JiHui :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, all
I want to do some doing on my many images, about 1,000 ;;;;;
at first, add alpha channel at each image, and change color #fff to transparent.
I think, "open -> add alpha -> select #fff by color -> del -> save"

but I don't know script-fu. and tried some ways, all fail.
please help me.

Greetings.
--
〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
Choi, JiHui
http://Mr-Dust.pe.kr
http://GIMP.kr
_______________________________________________
Gimp-user mailing list
Gimp-user@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Re: batch mode in gimp, add alpha, change color

by Kevin Cozens-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Choi, JiHui wrote:
> I want to do some doing on my many images, about 1,000 ;;;;;
> at first, add alpha channel at each image, and change color #fff to transparent.

I think you would be better off doing this using ImageMagick and a shell
script. The 'convert' program with the -alpha and -background options should
allow you to do what you want.

--
Cheers!

Kevin.

http://www.ve3syb.ca/           |"What are we going to do today, Borg?"
Owner of Elecraft K2 #2172      |"Same thing we always do, Pinkutus:
                                 |  Try to assimilate the world!"
#include <disclaimer/favourite> |              -Pinkutus & the Borg
_______________________________________________
Gimp-user mailing list
Gimp-user@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Re: batch mode in gimp, add alpha, change color

by xaviermasr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

El Thursday 01 May 2008 19:35:56 Kevin Cozens va escriure:
> Choi, JiHui wrote:
> > I want to do some doing on my many images, about 1,000 ;;;;;
> > at first, add alpha channel at each image, and change color #fff to
> > transparent.
>
> I think you would be better off doing this using ImageMagick and a shell
> script. The 'convert' program with the -alpha and -background options
> should allow you to do what you want.

Or you can do an script using Scheme. GIMP allows to use any of its functions
by script.

--
Xavier Mas
_______________________________________________
Gimp-user mailing list
Gimp-user@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Re: batch mode in gimp, add alpha, change color

by Choi, JiHui :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, May 2, 2008 at 2:35 AM, Kevin Cozens <kevin@...> wrote:
>  I think you would be better off doing this using ImageMagick and a shell
>  script. The 'convert' program with the -alpha and -background options should
>  allow you to do what you want.
>
I know about ImageMagick, but there is no version for windows.
even though I use windows and linux both.


On Fri, May 2, 2008 at 4:00 AM, Xavier Mas <xaviermasr@...> wrote:
>  Or you can do an script using Scheme. GIMP allows to use any of its functions
>  by script.
>
I tried to learn scheme, but it's so difficult.
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?

--
〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
Choi, JiHui
http://Mr-Dust.pe.kr
http://GIMP.kr
_______________________________________________
Gimp-user mailing list
Gimp-user@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Re: batch mode in gimp, add alpha, change color

by David Gowers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Fri, May 2, 2008 at 8:35 AM, Choi, JiHui <like.a.dust@...> wrote:
> On Fri, May 2, 2008 at 2:35 AM, Kevin Cozens <kevin@...> wrote:
>  >  I think you would be better off doing this using ImageMagick and a shell
>  >  script. The 'convert' program with the -alpha and -background options should
>  >  allow you to do what you want.
>  >
>  I know about ImageMagick, but there is no version for windows.
>  even though I use windows and linux both.

Not true.
see
http://www.imagemagick.org/script/binary-releases.php
"You can install ImageMagick from source. However, if don't have a
proper development environment or if you're anxious to get started,
download a ready-to-run Unix or Windows executable."

>
>
>
>  On Fri, May 2, 2008 at 4:00 AM, Xavier Mas <xaviermasr@...> wrote:
>  >  Or you can do an script using Scheme. GIMP allows to use any of its functions
>  >  by script.
>  >
>  I tried to learn scheme, but it's so difficult.
Learning python would be easier.

http://www.gimp.org/docs/python/pygimp.html

>  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?

I like to use the GIMP Python Console for batch processing.
Here is an example, that processes all PNG files in the current directory.

import glob.glob
for filename in glob.glob ('*.png'):
  image = pdb.gimp_file_load (filename, filename)
  # put your batch processing commands here.
  # for example
  #
  # pdb.gimp_threshold (image.layers[-1], 128,255)
  # would threshold the bottom layer.
  #
  pdb.gimp_file_save (image, image.active_layer, filename, filename)
  del image
_______________________________________________
Gimp-user mailing list
Gimp-user@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Re: batch mode in gimp, add alpha, change color

by Joao S. O. Bueno Calligaris :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: batch mode in gimp, add alpha, change color

by David Gowers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Fri, May 2, 2008 at 9:46 AM, Joao S. O. Bueno <gwidion@...> wrote:
>
>  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).

http://www.gimptalk.com/forum/topic/Python-And-Gimp-2-4-25587-1.html

links to a single combined package, with step-by-step instructions,
available here:
http://photocomix-resources.deviantart.com/art/Gimp-Python-support-easier-74889017
_______________________________________________
Gimp-user mailing list
Gimp-user@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user