Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
gimp native batch convert?
#12
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-

import os, glob, sys, time
from gimpfu import *


def process(infile):
        print "Processing file %s " % infile
        image = pdb.gimp_file_load(infile, infile, run_mode=RUN_NONINTERACTIVE)
        drawable = image.active_layer

        print "File %s loaded OK" % infile
        pdb.plug_in_photocopy(image, drawable,8.,0.8,0.2,0.2)
     
        outfile=os.path.join('processed',os.path.basename(infile))
        outfile=os.path.join(os.path.dirname(infile),outfile)
        print "Saving to %s" % outfile
        pdb.file_dds_save(image, drawable, outfile, outfile, 7, 0, 0, 0, 0, 7, 0, True,True,2.24,True,False,.5)
        print "Saved to %s" % outfile
        pdb.gimp_image_delete(image)


def run(directory):
        start=time.time()
        print "Running on directory \"%s\"" % directory
#   os.mkdir(os.path.join(directory,'processed'))
        for infile in glob.glob(os.path.join(directory, '*.jpg')):
                process(infile)
        end=time.time()
        print "Finished, total processing time: %.2f seconds" % (end-start)


if __name__ == "__main__":
        print "Running as __main__ with args: %s" % sys.argv

saved as batch.py

not sure where the directory is in this code?
Reply


Messages In This Thread
gimp native batch convert? - by y2keeth - 05-22-2023, 12:39 AM
RE: gimp native batch convert? - by Ofnuts - 05-22-2023, 07:28 AM
RE: gimp native batch convert? - by y2keeth - 05-22-2023, 08:51 AM
RE: gimp native batch convert? - by y2keeth - 05-23-2023, 03:28 AM
RE: gimp native batch convert? - by Ofnuts - 05-23-2023, 12:38 PM
RE: gimp native batch convert? - by y2keeth - 05-24-2023, 04:55 AM
RE: gimp native batch convert? - by y2keeth - 05-26-2023, 01:21 AM
RE: gimp native batch convert? - by y2keeth - 05-27-2023, 05:21 AM
RE: gimp native batch convert? - by rich2005 - 05-27-2023, 07:25 AM
RE: gimp native batch convert? - by Ofnuts - 05-27-2023, 07:57 AM
RE: gimp native batch convert? - by y2keeth - 05-28-2023, 01:47 AM
RE: gimp native batch convert? - by y2keeth - 06-06-2023, 04:40 AM
RE: gimp native batch convert? - by Ofnuts - 06-06-2023, 07:04 AM
RE: gimp native batch convert? - by y2keeth - 06-07-2023, 03:06 AM
RE: gimp native batch convert? - by y2keeth - 06-08-2023, 04:19 AM
RE: gimp native batch convert? - by Ofnuts - 06-08-2023, 08:29 AM
RE: gimp native batch convert? - by y2keeth - 06-09-2023, 04:53 AM
RE: gimp native batch convert? - by Ofnuts - 06-09-2023, 08:10 AM
RE: gimp native batch convert? - by y2keeth - 06-10-2023, 03:46 AM
RE: gimp native batch convert? - by Ofnuts - 06-10-2023, 06:44 AM
RE: gimp native batch convert? - by y2keeth - 06-13-2023, 03:53 AM
RE: gimp native batch convert? - by y2keeth - 06-19-2023, 11:44 AM

Forum Jump: