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

2009-07-27 Thread Marc T.
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

-- 
Marc T. (via www.gimpusers.com)
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


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

2009-07-27 Thread David Hodson
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


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


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

2009-07-27 Thread Marc T.
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..



-- 
Marc T. (via www.gimpusers.com)
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


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

2009-07-27 Thread Jay Smith
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
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


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

2008-05-01 Thread Choi, JiHui
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@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


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

2008-05-01 Thread Kevin Cozens
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@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


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

2008-05-01 Thread Choi, JiHui
On Fri, May 2, 2008 at 2:35 AM, Kevin Cozens [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


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

2008-05-01 Thread David Gowers
Hi,

On Fri, May 2, 2008 at 8:35 AM, Choi, JiHui [EMAIL PROTECTED] wrote:
 On Fri, May 2, 2008 at 2:35 AM, Kevin Cozens [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


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

2008-05-01 Thread Joao S. O. Bueno
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@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


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

2008-05-01 Thread David Gowers
Hi,

On Fri, May 2, 2008 at 9:46 AM, Joao S. O. Bueno [EMAIL PROTECTED] 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@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user