add watermark to images Python

Watermarking images is a widely used technique that allows content creators, photographers, and artists to protect their work and assert their ownership rights. By applying a visible mark onto an image, typically in the form of a logo or text, watermarking discourages unauthorized use and copyright infringement. In this article, we are going to provide you with a simple yet efficient solution to add a watermark on images in Python. So let’s see how to do it.

Python Library to Add Watermark to Images

Aspose.Imaging for Python is a powerful image processing library to work with a variety of image formats. Without writing complex code, the library lets you process images effortlessly. You can either download the library or install it using the following command.

> pip install aspose-imaging-python-net 

Add Watermark to an Image in Python

Aspose.Imaging for Python has made it very simple to insert watermarks on images, which can be accomplished in a few lines of code. Below are the steps to watermark an image in Python.

  • Load the image using Image class.
  • Create an instance of Graphics class and initialize it with Image object.
  • Set font family, size, and face using Font class.
  • Create an instance of SolidBrush class and set its properties such as color etc.
  • Instantiate StringFormat class to set text alignment.
  • Add watermark to the image using Graphics.draw_string(String, Font, SolidBrush, 0, 0, StringFormat) method.
  • Save the image using Image.save(String) method.

The following code sample shows how to add a watermark to an image in Python.

Below is the watermark added to an image using the code sample above.

Add diagonal watermark to image Python

Watermark Images Online

Use our free online image watermarking tool to add watermark on as many images as you need. You do not need to create an account to use this tool.

Free Python Image Watermarking Library

You can get a free temporary license and insert watermarks on images without evaluation limitations.

Conclusion

In this article, you have learned how to add watermark to images in Python. The step-by-step guide and code sample have demonstrated how to apply a watermark on an image with particular settings. In addition, we have provided you with an online tool to insert watermarks on images. This is a free tool and you can use it without creating any account.

In case you want to learn more about our Python image processing library, visit the documentation. If you would have any questions or queries, contact us via our forum.

See Also