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

Batch image conversion

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.

6 of 6 messages available
Toggle history

Please log in to manage your subscriptions.

Batch image conversion A B 25 Jul 10:49
  Batch image conversion Paulo Jorge de Oliveira Cantante de Matos 25 Jul 14:02
  Batch image conversion Jim 27 Jul 22:49
   Batch image conversion michael chang 27 Jul 23:25
   Batch image conversion Sven Neumann 28 Jul 01:31
    Batch image conversion Jim 28 Jul 22:17
A B
2005-07-25 10:49:09 UTC (almost 19 years ago)

Batch image conversion


I'm converting a huge load of sprites from a game into ones suitable for use in another (from Myth II to Doom) and of course this involves a huge amount of repetitive actions- to change the image mode from indexed to RGB, back to indexed but with the Doom palette, and then to go through all the hundreds of seperate frames and manually replace the blue (of hexadecimal reference 0000FF) with another colour (00FFFF). Since it is entirely repetitive, I reckoned batch mode could deal with it, so I read the tutorial at gimp.org on batch mode, but cannot understand it. I would manage to understand it in time, but in the meantime, does anyone know of any utilities that could help? for example are there any tools that could be used to assist in the generation of the batch scripts? Also, can the image->mode be changed through such a script? I know the sequence of events I want to script, but just don't know how to script it:
1.Change the Image mode to RGB
2.Apply the filter "colour exchange" (Filters->Colors->Map->Color exchange on the version I'm running [2.2.7 on Windows]) with the "from" colour being 0000ff and the "to" colour being 00ffff 3.Change the mode back to Indexed (Use custom palette, Don't remove unused colours from final palette, Dithering=none) 4.Do this to every image in a directory Any help really appreciated, if anyone does know of any useful utilities or anything at all that could help. Thanks in advanceMSN Premium gives you PC protection, junk-mail filters, advanced communication tools and great software like MSN Encarta

Paulo Jorge de Oliveira Cantante de Matos
2005-07-25 14:02:27 UTC (almost 19 years ago)

Batch image conversion

I really don't understand much about gimp batch mode but I think you could write a bash script to do it with convert.

Paulo Matos

A B said:

I'm converting a huge load of sprites from a game into ones suitable for use in another (from Myth II to Doom) and of course this involves a huge amount of repetitive actions- to change the image mode from indexed to RGB, back to indexed but with the Doom palette, and then to go through all the hundreds of seperate frames and manually replace the blue (of hexadecimal reference 0000FF) with another colour (00FFFF). Since it is entirely repetitive, I reckoned batch mode could deal with it, so I read the tutorial at gimp.org on batch mode, but cannot understand it. I would manage to understand it in time, but in the meantime, does anyone know of any utilities that could help? for example are there any tools that could be used to assist in the generation of the batch scripts? Also, can the image-

Jim
2005-07-27 22:49:18 UTC (almost 19 years ago)

Batch image conversion

A B wrote:

I'm converting a huge load of sprites from a game into ones suitable for use in another (from Myth II to Doom) and of course this involves a huge amount of repetitive actions- to change the image mode from indexed to RGB, back to indexed but with the Doom palette, and then to go through all the hundreds of seperate frames and manually replace the blue (of hexadecimal reference 0000FF) with another colour (00FFFF). Since it is entirely repetitive, I reckoned batch

I too would like to know how to write batch scripts for gimp. I've used convert before but what I need to do can't be accomplished with that program.

I have read the one page tutorial on batch mode, http://www.gimp.org/tutorials/Basic_Batch/ and have copied and pasted the script and commands and they don't work.

Anyone have a better tutorial that they can point us to?

Thanks in advance!

Jim

michael chang
2005-07-27 23:25:14 UTC (almost 19 years ago)

Batch image conversion

On 7/27/05, Jim wrote:

A B wrote:

I'm converting a huge load of sprites from a game into ones suitable for use in another (from Myth II to Doom) and of course this involves a huge amount of repetitive actions- to change the image mode from indexed to RGB, back to indexed but with the Doom palette, and then to go through all the hundreds of seperate frames and manually replace the blue (of hexadecimal reference 0000FF) with another colour (00FFFF). Since it is entirely repetitive, I reckoned batch

I too would like to know how to write batch scripts for gimp. I've used convert before but what I need to do can't be accomplished with that program.

I have read the one page tutorial on batch mode, http://www.gimp.org/tutorials/Basic_Batch/ and have copied and pasted the script and commands and they don't work.

Anyone have a better tutorial that they can point us to?

To be honest, no, because documentation is absolutely horrid in GIMP. However, you may wish to investigate books on Perl and Python, as well as Web Documentation on Scheme, Script-Fu and SIOD. In The GIMP, there is a SIOD console, and the procedure viewer lists the prototypes for the commands that can be accessed by scripts. BTW, the procedure browser lists commands with an underscore, but my version of the SIOD (Scheme) interpreter in the console uses dashes in places of the underscores.

First, you may wish to investigate the file_glob, and then things such as gimp-file-open or whatever it was called. You might also want to look up the colour exchange and the like (I believe the commands are prefixed with plugin- or something).

Although at this rate, surely it must have been faster to do it manually by hand than go through the trouble of scripting with GIMP? Unless you plan to due this often, repetitively, to many large batches, it's probably faster to do it by hand.

I'm new at scripting too, however, so I can't suggest a better method (I don't even know if this is the _recommended_ method of scripting).

Consider asking gimp-developer, since apparently that was supposed to be the designate mailing list for script/plugin development. *shrugs*

Sven Neumann
2005-07-28 01:31:02 UTC (almost 19 years ago)

Batch image conversion

Hi,

Jim writes:

I have read the one page tutorial on batch mode, http://www.gimp.org/tutorials/Basic_Batch/ and have copied and pasted the script and commands and they don't work.

The tutorial is supposed to work. You might want to tell us in what way it doesn't work for you.

Sven

Jim
2005-07-28 22:17:29 UTC (almost 19 years ago)

Batch image conversion

Sven Neumann wrote:

Hi,

Jim writes:

I have read the one page tutorial on batch mode, http://www.gimp.org/tutorials/Basic_Batch/ and have copied and pasted the script and commands and they don't work.

The tutorial is supposed to work. You might want to tell us in what way it doesn't work for you.

Sven

Hi Sven,

I created the script file on the webpage and called it batch-unsharp-mask

In the script file I have these lines:

(define (batch-unsharp-mask pattern radius amount threshold) (let* ((filelist (cadr (file-glob pattern 1)))) (while filelist
(let* ((filename (car filelist)) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (drawable (car (gimp-image-get-active-layer image)))) (plug-in-unsharp-mask RUN-NONINTERACTIVE image drawable radius amount threshold) (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename) (gimp-image-delete image)) (set! filelist (cdr filelist)))))

This is the command I run from the console:

gimp -i -b '(batch-unsharp-mask "*.jpg" 1.0 0.5 1)' '(gimp-quit 0)'

And this is the end result:

No batch interpreter specified, using the default 'plug_in_script_fu_eval'. batch command: experienced an execution error.

A bit of background info, I am running Fedora Core 3, gimp version 2.2.6 and Fedora is up to date with all of the released updates.

Thanks!

Jim