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 > script > 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. Chris
import os 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()[0] filename = img.name + "-sm.png" fullpath = os.path.join(path, filename); tmp = img.duplicate() tmp.flatten() tmp.crop(areaWidth, areaHeight, areaPosX, areaPosY) pdb.file_png_save(tmp, tmp.layers[0], fullpath, filename, 0, 9, 1, 1, 1, 1, 1) #pdb.gimp_image_delete(tmp)
_______________________________________________ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user