diff transformations/add_background_image.py @ 9:64dac4aabc04

Added in background script : character pixel inversion (from black to white, for dark backgrounds)
author Guillaume Sicard <guitch21@gmail.com>
date Tue, 26 Jan 2010 19:40:30 -0500
parents bdaa5bd26dcf
children 4d4248f7e2fb
line wrap: on
line diff
--- a/transformations/add_background_image.py	Tue Jan 26 18:58:10 2010 -0500
+++ b/transformations/add_background_image.py	Tue Jan 26 19:40:30 2010 -0500
@@ -20,8 +20,9 @@
 	sys.exit()
 
 char_image = sys.argv[1]
-image_dir = "./images/"                               
-pattern = "*.jpg"                                     
+image_dir = "./images/"
+pattern = "*.jpg"
+invert = False
 threshold = 100;
 
 ###########
@@ -55,6 +56,8 @@
 		for y in range(1, 32):
 			if pix[x, y] > threshold:
 				pix[x, y] = bg_pix[x, y]
+			elif invert:
+				pix[x, y] = 255 - pix[x, y]
 
 	return image
 
@@ -75,5 +78,3 @@
 #image.show()
 
 sys.stdout.write(" Done.\n")
-
-         
\ No newline at end of file