All pastes #1789796 Raw Edit

Miscellany

public text v1 · immutable
#1789796 ·published 2010-02-08 05:16 UTC
rendered paste body
#!/usr/bin/env python

#import glob
from gimpfu import *

def_path = "C:\\Home\\cd\\work\\web\\gradi1\\Poze\\Poze evenimente\\__IMAGINI-ANTET\\landscape\\00_DONE\\"
width = 420
height = 0
border_color = (0xff, 0xff, 0xff)

def python_batch_me(img, drawable, cale):
	for filename in glob.glob(cale + '*.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
		)

		# scale the image
		pdb.gimp_image_scale(img, width, width*img.height/img.width)
		
		# apply "fuzzy border"
		pdb.script-fu-fuzzy-border(
			img,				# image
			drawable,			# drawable
			border_color,	# border color
			16,					# border size
			1,					# (toggle) blur border
			4.0,				# granularity
			0,					# (toggle) shaddow
			100.0,				# shaddow weight
			0,					# (toggle) work on copy
			1					# (toggle) flatten image
		)

		# get layer
		drawable = pdb.gimp_image_get_active_layer(
			img				# image
		)
		
		# save file
		pdb.gimp_file_save(
			img,				# image
			drawable,			# drawable
			filename			# filename
			filename			# filename
		)

register(
	"python_fu_batch_me",
	"Scaleaza, apoi aplica fuzzy borders la toate*.jpg dintr-un folder",
	"Scaleaza, apoi aplica fuzzy borders la toate*.jpg dintr-un folder",
	"C.Dumitrescu",
	"C.Dumitrescu",
	"2010-02-08",
	"<Image>/Python-Fu/Batch-me01",
	"	",
	[
		#(PF_IMAGE, "image", "Input image", None),										# current image
		#(PF_DRAWABLE, "drawable", "Input layer", None),								# current layer
		#(PF_COLOR, "color", "Color of timestamp", (255, 255, 0)),						# color
		#(PF_SPINNER, "threshold", "Threshold", 60, (1, 255, 1)),						# threshold
		#(PF_SPINNER, "grow1", "Grow selection after color select", 3, (1, 255, 1)),		# grow1
		#(PF_SPINNER, "grow2", "Grow selection befor spread", 10, (1, 255, 1)),			# grow2
		#(PF_SPINNER, "spread_count", "Spread count", 3, (1, 10, 1)),					# spread count
		#(PF_SPINNER, "spread", "Spread value", 10, (1, 100, 1)),						# spread
		#(PF_SPINNER, "offset_count", "Offset count", 3, (1, 10, 1)),					# offset count
		#(PF_SPINNER, "offset", "Offset value", 3, (1, 100, 1))							# offset
		#(PF_DIRNAME, "cale", "Calea folderului", cale)
		(PF_DIRNAME,"cale","Cale",def_path)
    ],
	[],
	python_batch_me
)

main()