Could you please share your findings? I would also like
to learn how to
script Blender once I start get going on Gimp.
Finally I made it. Please find enclosed a solution.
Cheers,
Nils
import os
import subprocess
from subprocess import PIPE
import glob
#
# Processing image files using Gimp's autocrop function
# The file script-autocrop.scm should be placed in ~/.gimp-2.6/scripts/
#
p = subprocess.Popen(["gimp --version"],shell=True,bufsize=0,stdin=PIPE, stdout=PIPE, close_fds=True)
(child_stdin, child_stdout) = (p.stdin, p.stdout)
gimp_version = child_stdout.read().split()[-1]
png_files = glob.glob('*.png')
png_files.sort()
for file in png_files:
if not 'crop' in file:
print 'Processing', file
file_crop = file[:-4]+'_crop.png'
if gimp_version =='2.6.2':
os.system("gimp --batch-interpreter plug-in-script-fu-eval -i -d -b '(script-autocrop " + "\""+file +"\"" + "\"" + file_crop + "\"" + ")' -b '(gimp-quit 0)'")
os.system("convert -loop 0 *crop.png test.gif")
os.system("animate test.gif")
(define (script-autocrop filename-in filename-out)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename-in "")))
(drawable (car (gimp-image-get-active-layer image)))
)
(plug-in-autocrop RUN-NONINTERACTIVE image drawable)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename-out "")
(gimp-image-delete image)
)
)
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users