Adding a watermark works as copyright for image so that no one can illegally use the image or document. I have used OpenCV for this project to add logo and text as a watermark. Different organizations can use it to make their content secure so that their content cannot be misused without their license.
- Loading the image and logo from website or local directory.
- Resizing the images.
- Converting the images into RGB format and then converting it into numpy array.
- Storing the height and width of the image and logo.
- Finding out the coordinates of the center of the image.
- Fining out the region of interest to dra logo.
- Merging the logo with the image and vizualizing it.
- Creating the text watermark.
- Using CV2 function to define tet properties and applying it at specific coordinates.
- Converting the image into RGB and vizualizing it.
I also dockerized the code to handle the dependencies and for easier running the flask app. It will automatically install all the necessary libraries and run the project.
- Make sure your Docker Daemon is running.
- Clone the project:
$git clone https://github.com/asifmustafa87/Watermarking-Images-Using-Flask-App.git
- Change the directory to Watermarking-Images-Using-Flask-App:
$cd Watermarking-Images-Using-Flask-App
- Create docker image named watermarking_flask_app:
$docker build -t watermarking_flask_app .
- To check whether the image created correctly or not:
$docker images
- Create the Docker container
$docker run -p 5000:5000 -t -i watermarking_flask_app:latest
- The browser should open automatically. If not, open the browser and type "127.0.0.1:5000" or "localhost:5000" and the app will run perfectly.