Source

Scripts / Gimp / watermarkBatchTools.py

Diff from to

File Gimp/watermarkBatchTools.py

 			y_cord =  round((h * (imgheight - textBoxHeight)) / gridy)
 			y_cord_1 =  round(((h + 1) * (imgheight - textBoxHeight)) / gridy) #Next Element
 			
-			x =  round(((x_cord + x_cord_1) / 2)) - font_size
-			y =  round((y_cord + y_cord_1) / 2)
+			if round(((x_cord + x_cord_1) / 2)) - textBoxWidth < 0:
+				x = font_size
+			elif (round(((x_cord + x_cord_1) / 2)) + textBoxWidth) < imgwidth:
+				x =  round(((x_cord + x_cord_1) / 2)) - font_size
+			else:
+				x =  round(((x_cord + x_cord_1) / 2)) - font_size
 			
 			texture = pdb.gimp_text_fontname( imglayer,texture_layer,x,y,copyright,-1,True,font_size,PIXELS,fontname)
 			pdb.gimp_text_layer_set_color(texture, fontcolor)
 					y_cord =  round((h * (imgheight - textBoxHeight)) / gridy)
 					y_cord_1 =  round(((h + 1) * (imgheight - textBoxHeight)) / gridy) #Next Element
 					
-					x =  round(((x_cord + x_cord_1) / 2)) - font_size
-					y =  round((y_cord + y_cord_1) / 2)
+					if round(((x_cord + x_cord_1) / 2)) - textBoxWidth < 0:
+						x = font_size
+					elif (round(((x_cord + x_cord_1) / 2)) + textBoxWidth) < imgwidth:
+						x =  round(((x_cord + x_cord_1) / 2)) - font_size
+					else:
+						x =  round(((x_cord + x_cord_1) / 2)) - font_size
 					
 					texture_layer = pdb.gimp_text_fontname( img,texture_layer,x,y,copyright,0,True,font_size,PIXELS,fontname)
 					pdb.gimp_text_layer_set_color(texture_layer, fontcolor)