RSS/Atom feed Twitter
Site is read-only, email is disabled

batch mode in gimp, add alpha, change color

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.

12 of 12 messages available
Toggle history

Please log in to manage your subscriptions.

batch mode in gimp, add alpha, change color Choi, JiHui 01 May 15:54
  batch mode in gimp, add alpha, change color Kevin Cozens 01 May 19:35
   batch mode in gimp, add alpha, change color Xavier Mas 01 May 21:00
    batch mode in gimp, add alpha, change color Choi, JiHui 02 May 01:05
     batch mode in gimp, add alpha, change color David Gowers 02 May 01:46
      batch mode in gimp, add alpha, change color Marc T. 27 Jul 16:30
       batch mode in gimp, add alpha, change color David Hodson 27 Jul 16:50
        batch mode in gimp, add alpha, change color Marc T. 27 Jul 17:10
         batch mode in gimp, add alpha, change color Jay Smith 27 Jul 17:38
       batch mode in gimp, add alpha, change color Ken Warner 27 Jul 18:29
     batch mode in gimp, add alpha, change color Joao S. O. Bueno 02 May 02:16
      batch mode in gimp, add alpha, change color David Gowers 02 May 03:24
Choi, JiHui
2008-05-01 15:54:57 UTC (over 16 years ago)

batch mode in gimp, add alpha, change color

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.

Kevin Cozens
2008-05-01 19:35:56 UTC (over 16 years ago)

batch mode in gimp, add alpha, change color

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.

Xavier Mas
2008-05-01 21:00:14 UTC (over 16 years ago)

batch mode in gimp, add alpha, change color

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.

Choi, JiHui
2008-05-02 01:05:47 UTC (over 16 years ago)

batch mode in gimp, add alpha, change color

On Fri, May 2, 2008 at 2:35 AM, Kevin Cozens 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 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?

David Gowers
2008-05-02 01:46:48 UTC (over 16 years ago)

batch mode in gimp, add alpha, change color

Hi,

On Fri, May 2, 2008 at 8:35 AM, Choi, JiHui wrote:

On Fri, May 2, 2008 at 2:35 AM, Kevin Cozens 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 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

Joao S. O. Bueno
2008-05-02 02:16:40 UTC (over 16 years ago)

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

David Gowers
2008-05-02 03:24:57 UTC (over 16 years ago)

batch mode in gimp, add alpha, change color

Hi,

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

Marc T.
2009-07-27 16:30:07 UTC (over 15 years ago)

batch mode in gimp, add alpha, change color

i am on a similar problem,
i have to build a batch script that slices over 6000 images very big images into seven pieces.

I think you would be better off doing this using ImageMagick and a

shell

ImageMagick seems to first read all images into memory and then working with it.
and this dosn't work with some couple of GB and besides there is no status of completness, so you never know when it'll be finished. i wrote a batch FOR loop, but it turned out to be too slow, scince it has to start image magick over and over...

i tried script-fu, but scheme is just a little too wierd for me comming from a java, background,
and there seems to be no error status messages, for dubugging,
so i never know what i did wrong this time.

well so
Gimp and Python seems to be good alternative, but i have to start the script from commandline, so how would you do this?

and i tried to copy this script to the python-fu console:

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

it says it's missing the glob.glob, where would i get this?

thanx

marc

David Hodson
2009-07-27 16:50:13 UTC (over 15 years ago)

batch mode in gimp, add alpha, change color

On Mon, 2009-07-27 at 16:30 +0200, Marc T. wrote:

i am on a similar problem,
i have to build a batch script that slices over 6000 images very big images into seven pieces.

David's Batch Processor should be able to do the job, not by slicing but by cropping each slice out of the image one at a time. Not the most efficient technique, but it should work.

-- David

Marc T.
2009-07-27 17:10:34 UTC (over 15 years ago)

batch mode in gimp, add alpha, change color

On Mon, 2009-07-27 at 16:30 +0200, Marc T. wrote:

i am on a similar problem,
i have to build a batch script that slices over 6000 images very big

images

into seven pieces.

David's Batch Processor should be able to do the job, not by slicing but by cropping each slice out of the image one at a time. Not the most efficient technique, but it should work.

-- David

thanx for the quick reply,
but i really need to start the process from command line, to integrate it into a bigger workflow.
and efficensy is a big isssue also,
otherwise i could just stick to imagemagick

i basically just need to know how i can start python batch scripts from commandline,
can't find anything via google...
maybe it's too simple..

Jay Smith
2009-07-27 17:38:07 UTC (over 15 years ago)

batch mode in gimp, add alpha, change color

On 07/27/2009 11:10 AM, Marc T. wrote:

On Mon, 2009-07-27 at 16:30 +0200, Marc T. wrote:

i am on a similar problem,
i have to build a batch script that slices over 6000 images very big

images

into seven pieces.

David's Batch Processor should be able to do the job, not by slicing but by cropping each slice out of the image one at a time. Not the most efficient technique, but it should work.

-- David

thanx for the quick reply,
but i really need to start the process from command line, to integrate it into a bigger workflow.
and efficensy is a big isssue also,
otherwise i could just stick to imagemagick

i basically just need to know how i can start python batch scripts from commandline,
can't find anything via google...
maybe it's too simple..

Mark,

I am speaking _without_ much experience here, and I am not the one who wrote the scripts, but we process thousands of images in large & small batches using ImageMagick. We use Perl, which has a ImageMagick module (or whatever you call it).

We have one Perl script that does the actual work. However, we use an outer wrapper Perl script to do the finding of the files that need to be worked on.

We run from the command line.

As far as I know, we are starting ImageMagick only once.

The process looks at about 40,000 potential source tiff images and makes sure that none are newer than the about 160,000 target jpeg images. If any tiffs are newer (or the jpegs don't exist), from each tiff, we make 4 jpegs of different output pixel dimensions, based on a complicated algorithm determining/scaling output pixel dimensions based on input image size (physical dimension as 300 dpi tiff).

If no images need to be made, then the whole thing runs in about 3 minutes or so.

(This is on a fairly old RedHat 8 linux server -- if it was running on my new workstation and if the files themselves were on my new workstation, it would at least double the speed.)

When images do need to be made, if the source tiffs are small (i.e. 300 KB), then they only take a couple seconds each. If the source tiffs are large (i.e. for us 10-20 MB), then they take maybe 6-10 seconds each depending upon what else is happening on the system. Again, these speeds could surely be at least doubled on better hardware.

Regarding your really big images > 1 GB, if you are working with stuff like than, then you need to be working with hardware that has enough memory. Images that large (perhaps these are satellite photos?) are surely "important", thus get a system that can do the job. Even my lowly workstation has 4 GB of RAM and two 1 TB hard disks and dual quad-core (2 GB I think?) processors. I think I spent $700 on it, not including the monitor. The hardware cost is NOT the problem. The problem is the skilled time to configure this kind of stuff to _really_ work.

Look at Perl with ImageMagick.

Jay

Ken Warner
2009-07-27 18:29:32 UTC (over 15 years ago)

batch mode in gimp, add alpha, change color

I'm a Java programmer also. Batch processing in GIMP using Scheme is just not a practical solution.

Marc T. wrote:

i am on a similar problem,
i have to build a batch script that slices over 6000 images very big images into seven pieces.

i tried script-fu,
but scheme is just a little too wierd for me comming from a java, background,
and there seems to be no error status messages, for dubugging,
so i never know what i did wrong this time.