Welcome to the Image Watermarking repository, a GUI desktop application developed using Python and its Tkinter library. This project offers a seamless solution for watermarking images, allowing users to upload their desired image, input a custom text, and have that text elegantly watermarked onto the image. The application provides a user-friendly interface where you can easily perform this task and save the watermarked image directly to your system's Pictures folder. Whether you want to protect your creative work or add a personalized touch to your images, the Image Watermarking desktop application provides a convenient and efficient solution. Enhance your image editing capabilities with this easy-to-use GUI application and start watermarking images with precision and style.
Click to View the Complete Step-by-Step Guide to Building this Project.Import the Tkinter library and create a window object using Tk(). Then call mainloop() method to keep the window on unless closed by the user.
We use the canvas widget to create a background. We first set up its size equal to the image dimensions. Create a usable image using PhotoImage() . Then we use create_image and create_text to display an image and text for good UI. We create an input field and two buttons for uploading images and submit button. We use grid layout to display our widgets in a systematic matter.
We first define a method for the Upload button. We use filedialog.askopenfilename method of tkinter to open a dialogue box to ask the user to upload the file.
Then we save its name and display the name on the screen and make Upload button text green to show the file as uploaded.
The uploaded file path is saved in a global variable passed to the method of submit button.
We need the pillow library to watermark our image. Pillow is a library for Image Processing. We use three objects from it, Image, ImageDraw, and ImageFont. We create a new image with the same dimensions as the older one and write a piece of text on it with a defined colour code. Then we save it and show it to the user. After that, we reset the widgets to make them look ready to take another input.