for Microsoft Power Automate and Azure logic apps

How to proportionally watermark an image with Power Automate

By Sophie Charlwood

14th November 2023

How to proportionally watermark an image with Power Automate

Are you stuck trying to automatically watermark images with Power Automate but all your images are different sizes? Maybe one was taken on a phone and another isn’t in a standard format or even a regular image ratio. Whenever this is the case, you will need your watermark to be adjusted to match the image dimensions automatically. 

Video Guide

Watch the how-to video here or keep reading for a step-by-step guide!

How-to Guide

In this flow, we will use the ‘Add Image Watermark to Image‘, ‘Get Image Information‘ and ‘Resize an Image‘ Encodian Flowr actions to resize a watermark image in proportion to a sample image and then combine them with Power Automate.

screenshot of the whole flow with encodian actions highlighted

The Flow

Firstly, we need to bring the watermark image content into the flow to find its dimensions to use in the resizing calculation in a future step. In this example, the watermark image is saved in a OneDrive location. Once we have the image content, we can use the Get Image Information‘ Flowr action to find the dimensions of the watermark. 

Steps 1-3 of the flow

The images that need watermarking are saved in a OneDrive folder; the flow will loop through each item in the folder to add the watermark. To do this we need to use the ‘List files in folder‘ OneDrive action. This step will change depending on where your images are saved and how you pass them into the flow. 

Finally, before we start looping through each image, a variable called ‘Resize Percentage‘ is initialised, which stores the percentage that the watermark image will be resized. The variable is of type float. 

steps 4-5 of the flow

The remaining flow steps will all take place in and apply to each loop. 

Now we have the OneDrive path of the image – we can get the image content. We can then use this with a second ‘Get Image Information‘ Flowr action to get the image dimensions. Once we have the image dimensions, we can determine whether the image is portrait or landscape; the orientation of the image will alter the maths used. 

steps 6-8 of the flow in the apply to each loop

Once the orientation of the image is determined, the desired height of the watermark image is calculated using the following calculations:

Calculations to calculate what the new height needs to be for the watermark image


In these calculations, the watermark image is set at 20% of the image size; you can change this percentage by changing the decimal multiplier in the calculations.

When we know what the height of the watermark image needs to be, we can calculate what the resize percentage is to reach the desired height. The calculation for this is the same for both portrait and landscape orientations.

The calculation to calculate the watermark image resize percentage


In the Power Automate expressions, we add float() to ensure the outputs are float values; this is needed for the rounding in the next step. Once the percentage has been calculated, it can be set to the ‘Resize Percentage‘ variable we initialised at the start of the flow.

Steps 6-8 of the flow

Now we have everything we need to resize the watermark image and add it to the sample image!

The last Power Automate expression we need to use rounds the resize percentage to a whole number; this is the input for the Resize Percentage field of the ‘Resize Watermark‘ step:

Rounding expression

if(greater(Mod(variables('Resize Percentage'),1),0.5),add(int(first(split(string(variables('Resize Percentage')),'.'))),1),first(split(string(variables('Resize Percentage')),'.')))

After the watermark is added to the image, the last step is to save the newly watermarked images. My flow saves the images to a OneDrive folder, but this step will likely change depending on your use case.

Steps 9-11 of the flow

The Results

Sample Image 1 - before Sample image 1 - after

sample 2 - before sample 2 - after

sample 3 - before  sample 3- after

sample 4 - before sample 4 - after