On Friday 24 June 2005 10:28, Jon Lapham wrote:
> nuno alexandre wrote:
> > you can use convert from ImageMagick.
> > [snip shell script]
> As I mentioned, I have a perl script (incidently using the
> ImageMagick module) which does exactly what your shell script does.
> I was just curious if/how the Gimp could do it, as I use the Gimp
> for all my image processing except for this one step.
Using Python Scripting it would be a matter of a few lines. The only
drawback is that you'd have to change the script code for each
processing job you need to do in the batch.
I will post here the Python script needed to rotate each image in a
dir by 270 degrees and saving the result with an "R" appended to the
I apologize for the portuguese names inside the code - I had used
this script as an example ina local forum.
You have to replace the line "pdb.gimp_image_rotate (...)" for the
actions you need applied to the image (check what is available in the
GIMP Procedure Browser in the Xtns menu). Offcourse, you also need
gimp-python installed (it is tehre if you have a "python-fu" menu
entry. Else, it is usually available from Linux distros as a
separate package, or you have to give ./configure an
"--enable-python" option if you compile your own GIMP.
from gimpfu import *
def rotacao_em_massa (diretorio):
for arquivo in os.listdir (diretorio):
nome = os.path.join (diretorio, arquivo)
imagem = pdb.gimp_file_load (nome, nome)
pdb.gimp_image_rotate (imagem, ROTATE_270)
tmp = arquivo.split(".")
novo_nome = os.path.join (diretorio, tmp + "R" + tmp)
pdb.gimp_file_sabe (imagem, imagem.layers,
"Rotaciona as imagens em um diretório",
"rotacao_em_massa (diretorio) -> None",
"Joao S. O. Bueno Calligaris",
"(k) All rites reversed - reuse whatever you like- JS",
"<Xtns>/Python-Fu/Rotacionar em Massa",
[(PF_FILE, "diretorio", "diretorio a transformar",""),
> Thanks, Jon
Gimp-user mailing list