iLoveIMG Developers
Log in Sign up

Watermark Image Guide
Develop your own solution to protect images and photos with custom watermarks by integrating with iLoveIMG’s REST API.

Remember that in order to use our Tool Guides, you need to have previous knowledge about the basics to processing a PDF with our REST API. We strongly recommend that you read the Processing a PDF guide before starting this one.

Basic add a watermark

You can add a watermark to your PDF files as shown in this code:

Start task

The Watermark tool is composed of 2 different elements that can be configured throught the property type: text type adds text watermarks and image type adds image-based watermarks. The image type is limited to PNG and JPG format files no bigger than 1Mb.


There is a list of default settings which can be customized, as you will see later.

Advanced add watermarks

Setting watermark opacity

Setting watermark opacity

With transparency you can set the opacity intensity of a watermark for both the text (as shown on the code example) and image files.

Setting watermark position

Setting watermark layer depth

With gravity will place your watermark according different document locations. Accepted values are: North, NorthEast, NorthWest, Center, CenterEast, CenterWest, East, West, South, SouthEast, SouthWest


Also, you can define vertical_adjustment_percent and horizontal_adjustment_percent in order to move the element vertically or horizontally having as an origin the selected gravity origin.

Watermark mosaic

Watermark mosaic

If mosaic is set to true, will stamp a 3x3 matrix mosaic of your watermark.

Watermark rotation

Watermark rotation

rotation will stamp your watermark rotated by the specified degrees amount.

Set a watermark font format

Note that this function only works with the text based watermarks. Trying to customize a font with an image will give an error.

Set a watermark font format

font_family, font_style, font_size and font_color are properties to customize text font format. The font_family property changes which font will be used, the font_style property changes the text style such as bold or italic, the font_size property changes the font size, and the font_color property changes the color of the watermark text.