11-15-2018, 01:53 PM
You don't need "with_files" in Python since you have something like this already in the language:
You stuff this a plugin that takes a single argument that you declare as a PF_DIRNAME in the registration. The user starts the script from a Gimp menu; enters the directory, and there you go.
Coded "from the hip", so some mistakes/oversight possible.
You can make that a shell batch but it's a bit more complicated.
Code:
import glob
for file in glob.glob(sourcedir+'/*.xcf'): # '/' also works in Windows
img=pdb.gimp_file_load(file)
pdb.gimp_image_set_resolution(img, 96.0, 96.0)
pdb.gimp_file_save(img, drawable, file, file)
pdb.gimp_image_clean_all(img)
pdb.gimp_image_delete(image) # only removes the image from Gimp!
You stuff this a plugin that takes a single argument that you declare as a PF_DIRNAME in the registration. The user starts the script from a Gimp menu; enters the directory, and there you go.
Coded "from the hip", so some mistakes/oversight possible.
You can make that a shell batch but it's a bit more complicated.