avatarHarlan Brothers

Summary

The article presents a Google Colab notebook that simplifies the process of adding customizable watermarks to images, aiding in copyright protection and brand promotion, with the added capability of embedding secret messages through steganography.

Abstract

The detailed guide explains how to use a versatile Google Colab notebook to watermark images, which is particularly useful for artists and data visualization creators looking to maintain attribution for their online work. The notebook allows users to download fonts, mount Google Drive, and adjust various parameters such as watermark text, position, color, and opacity. It provides a user-friendly interface for selecting and formatting watermarks, and it supports both visible and hidden (steganographic) watermarking. The process is designed to be quick and reversible, with a preview feature that enables users to fine-tune their watermarks without repeatedly downloading images.

Opinions

  • The author suggests that watermarking is a subjective choice, acknowledging the dilemma between protecting one's work and preserving its aesthetic appeal.
  • The tool is praised for its flexibility, allowing users to be as bold or subtle as desired with their watermarks, including the option for virtually invisible watermarks that serve copyright purposes without distracting from the image.
  • The article implies that the reuse of online content without proper attribution is a common issue, emphasizing the importance of establishing ownership through watermarking.
  • The author expresses enthusiasm for the potential of the notebook to explore steganography, highlighting the intriguing aspect of concealing information within images in a way that is imperceptible to the naked eye.
  • By providing a direct link to the Colab notebook on GitHub, the author encourages readers to take advantage of the tool, suggesting that it can be a valuable resource for maintaining intellectual property rights and promoting one's brand.

A Fast and Easy Way to Watermark Your Creations Using Google Colab

This simple, versatile notebook can help you maintain attribution for your graphics and AI artwork. It can even embed secret data.

“Watermark” with a deliberately visible watermark that was generated by the Colab notebook referenced in this article. (Image by Author using Stable Diffusion)

T o watermark or not to watermark, that is the question. Alas, there’s no simple answer. You’ve spent countless hours refining your data visualization or artwork to share online. Perhaps you want to help establish copyright ownership, discourage unattributed reuse of your work, or simply gain name recognition. On the other hand, you might be reticent to mar your wonderful work with possibly unsightly text.

Either way, this notebook is for you! Here’s a quick rundown.

The first two code blocks will download a selection of fonts from Font Squirrel, mount your Google Drive, and create directory for the images you want to watermark. You’ll then come to this form:

Formatting parameters for watermark notebook.

1) Using the Files pane, hover over an uploaded file in MyDrive/Uploads and press the 3 vertical dots. Copy the path and paste it into the “path” field:

How to copy the image path.

2) Add your name, pseudonym, or secret message (more on that in a bit) to the “watermark” field.

3) Choose a font from the drop-down menu, and enter the font size.

4) You can position your watermark using the “xCoor” and “yCoor” variables. The point (0, 0) is located in the upper left corner of the image (unlike the usual Cartesian coordinates, positive y is down).

5) The default color palette for text is grayscale and is determined by the variable “grayVal.” For colored text, replace the “grayVal” entries in the “textColor” field with individual RGB values (e.g., (42, 70, 99)).

6) Set the “opacity.” The scale runs from 0 (transparent) to 255 (opaque).

7) Run the code block.

That’s it. The notebook will automatically download the watermarked image and also preview it so that you can tweak things without having to open the downloaded image.

Using this tool, you can be as bold or subtle as you like. With a low opacity and judicious use of font size and color, your watermark can be virtually invisible, yet sufficient for the purpose of establishing ownership of your image.

For example, let’s say I’ve come up with a nice visualization for an article about where Millennials are likely to be renting in the future (see Figure 1). Given the popularity of posts about trends in the housing market, I figure that once it’s online, some bloggers (or auto bloggers) out there are likely to “borrow” my insight and appropriate the graphic with a 50/50 chance of proper attribution.

So, I upload my 1600 x 1200 image to Google Drive and run the watermarker. After quickly previewing a few different locations, I decide that (852, 950) with the 20pt, OpenSans-Regular font and an opacity of 192 is just right — not obtrusive, but visible enough to show my authorship.

Figure 1. Watermarked graphic representing the predicted popularity of Millennial rental markets for select cities. (Image by Author)

In fact, because you can be a subtle as you’d like, you can even use the notebook to explore the field of image steganography — the practice of concealing information in plain sight. For example, here are two seemingly identical images:

Original image. (Image by Author)
Watermarked image. (Image by Author)

Here’s what happens when we subtract the original image (top) from the watermarked image (bottom) and apply gamma correction and binarization:

Steganographic data retrieved from the watermarked image above. (Image by Author)

So go ahead — lay claim your intellectual property, promote your brand, or just have fun with steganography. You can download or open the Colab notebook directly from GitHub. Enjoy!

If you enjoyed this piece, you might want to consider becoming a Medium member to get unlimited access to all of the articles on Medium. If you register using this link, you can also support me as a writer, researcher, and creator.

Watermark
Colab
Data Science
Copyright
Steganography
Recommended from ReadMedium