#!/usr/bin/env python

import glob
from gimpfu import *

for filename in glob.glob("/path/to/images/*.jpg"):
	# print name for debugging
	print filename
	# load image
	img = pdb.gimp_file_load(
		filename,		# filename
		filename		# filename
	)
	# get layer
	drawable = pdb.gimp_image_get_active_layer(
		img				# image
	)
	# remove timestamp
	pdb.python_remove_timestamp(
		img,			# image
		drawable,		# drawable
		(255, 255, 0),	# color (yellow)
		60,				# threshold
		3,				# grow1
		10,				# grow2
		3,				# spread_count
		10,				# spread
		3,				# offset_count
		3				# offset
	)
	# get layer
	drawable = pdb.gimp_image_get_active_layer(
		img				# image
	)
	# select date area
	pdb.gimp_rect_select(
		img,			# image
		img.width * 0.955 - 500,		# x
		img.height * 0.895 - 100,		# y
		500,			# width
		100,			# height
		2,				# operation (0=add, 1=substract, 2=replace, 3=intersect)
		False,			# feather
		0				# feather-radius
	)
	# save file
	pdb.gimp_file_save(
		img,				# image
		drawable,			# drawable
		filename,			# filename
		filename			# filename
	)
# quit gimp
pdb.gimp_quit(0)
