Mercurial > ift6266
comparison transformations/gimp_script.py @ 7:f2d46bb3f2d5
Ajout de filtres GIMP (transformations/gimp_script.py)
author | boulanni <nicolas_boulanger@hotmail.com> |
---|---|
date | Tue, 26 Jan 2010 18:42:53 -0500 |
parents | |
children | d511445f19da |
comparison
equal
deleted
inserted
replaced
6:424b5b0d9fcb | 7:f2d46bb3f2d5 |
---|---|
1 #!/usr/bin/env python | |
2 # coding: utf-8 | |
3 | |
4 ''' | |
5 Exemple de script GIMP sous Python | |
6 Auteur: Nicolas Boulanger-Lewandowski | |
7 Date: Hiver 2010 | |
8 | |
9 usage: | |
10 gimp -i --batch-interpreter python-fu-eval --batch - < gimp_script.py | |
11 | |
12 Décommenter les lignes appropriées pour différents filtres | |
13 Les plug-ins de GIMP et leurs paramètres sont disponibles sous GIMP, menu Help > Plug-in Browser (toujours ignorer le paramètre run-mode). | |
14 Les autres fonctions du programme sont dans la Procedure DataBase (PDB) dans le menu Help > Procedure Browser. | |
15 ''' | |
16 | |
17 from gimpfu import * | |
18 import os, glob | |
19 | |
20 filename = "images/*.jpg" | |
21 folder = "out/" | |
22 | |
23 filenames = glob.glob(filename) | |
24 filenames.sort() | |
25 | |
26 for fname in filenames: | |
27 img = pdb.gimp_file_load(fname, fname) | |
28 layer1 = img.active_layer | |
29 img.disable_undo() | |
30 | |
31 # Simple filters | |
32 #pdb.plug_in_noisify(img, layer1, 0, 0.4, 0, 0, 0) | |
33 #pdb.plug_in_c_astretch(img, layer1) | |
34 #pdb.plug_in_emboss(img, layer1, 10, 30, 5, 0) | |
35 pdb.plug_in_applylens(img, layer1, 2, 1, 0, 0) | |
36 #pdb.plug_in_blur(img, layer1) | |
37 #pdb.plug_in_gauss_rle(img, layer1, 9, 1, 0) | |
38 | |
39 # More complex processing | |
40 #layer2 = layer1.copy() | |
41 #layer2.mode = MULTIPLY_MODE | |
42 #img.add_layer(layer2, 0) | |
43 #pdb.plug_in_solid_noise(img, layer2, 0, 0, 0, 8, 8, 8) | |
44 #img.flatten() | |
45 #layer1 = img.active_layer | |
46 | |
47 fname2 = folder + '/' + os.path.basename(fname) | |
48 pdb.gimp_file_save(img, layer1, fname2, fname2) | |
49 print fname2 | |
50 | |
51 pdb.gimp_quit(0) |