Example #1
0
	def watermark_image(self):

		"""
		Method to run when user clicks the Watermark button
		"""
		
		text_pos = (self.x, self.y)
		
		if self.img_file == None:
			tkMessageBox.showerror("No image", "No image selected")
			
		elif self.text.get() == "" or self.text.get() == None:
			tkMessageBox.showerror("Text Missing", "Please enter watermark text")

		elif self.textfont == None:
			tkMessageBox.showerror("No Font", "Please click on the image to select co-ordinates!")
			
		elif self.x == None or self.y == None:
			tkMessageBox.showerror("No Co-ords", "Please click on the image to select co-ordinates!")
			
		else:
			self.watermark_img = font.watermark(self.img_file, self.text.get(), self.textfont, text_pos, self.opacity_scale.get())

			self.pimg = ImageTk.PhotoImage( self.watermark_img )

			self.set_image()
Example #2
0
def test(app):

	opacity = app.opacity_scale.get()
	print opacity
	
	text_pos = (app.x, app.y)


	font_file = "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf"
	Font = font.select_font(font_file)
	text = "Varun Agrawal"

	watermark_img = font.watermark(File, Font, text, text_pos, int(trans*255/100))

	print opacity
	print text_pos
	
	canvas.create_image(0, 0, image=watermark_img)
	canvas.config(scrollregion=canvas.bbox(Tkinter.ALL))