On Sat, Jan 2, 2010 at 1:44 PM, Fab <for...@gimpusers.com> wrote:
> Hi to both,
> thanks for your help and thanks for the script! I tried the attached python
> by using execfile("script.py") from the python-fu console. Unfortunately gimp
> (2.6.7 on ubuntu) crashed. Do you have a hint, what I am doing wrong!?
Yes - that was originally written as a plug-in (place in
~/.gimp-2.x/plug-ins, chmod +x, it registers as 'File->Export Area').
I think this code should work in the console - either via execfile or
typing/pasting it in.
from gimpfu import *
# size and position of rectangle
areaWidth = 200
areaHeight = 200
areaPosX = 20
areaPosY = 20
# path to save PNG
path = os.path.join(os.path.expanduser('~'),'Desktop')
# operate on first image
img = gimp.image_list()
filename = img.name + "-sm.png"
fullpath = os.path.join(path, filename);
tmp = img.duplicate()
tmp.crop(areaWidth, areaHeight, areaPosX, areaPosY)
pdb.file_png_save(tmp, tmp.layers, fullpath, filename, 0, 9, 1, 1, 1, 1, 1)
Gimp-user mailing list