def python_resize(fname, startXY, scaleXY): dname = os.path.dirname(fname) files = glob.glob(os.path.join(dname, '*')) i = startXY for f in files: #name, ext = os.path.splitext(f) dname, name = os.path.split(f) newfilename = os.path.join(dname, "resized"+name) print "Scale ",name,"save to",newfilename image = pdb.gimp_file_load(f,f) #drawable = pdb.gimp_image_get_active_drawable(image) nh = int(round(image.height * i)) nw = int(round(image.width * i)) print i, nh, nw # resize the image to the containing box pdb.gimp_image_resize(image, nw, nh, 0, 0) # save and close the file if len(image.layers) > 1: finalLayer = pdb.gimp_image_merge_visible_layers(image, CLIP_TO_IMAGE) else: finalLayer = image.layers[0] pdb.gimp_file_save(image, finalLayer, newfilename, newfilename) i *= scaleXY