Using QuickChart with Power Automate Desktop to watermark images

How I can use the QuickChart to watermark image using the URL of the main image and the watermark image then return the URL of the generated image.
What should be the Accept, Content-Body and the Request Body

Hi @kingda,

Have a look at the parameters listed on the Watermarks documentation: Watermark API | QuickChart

These parameters can be supplied in the JSON request body, for example:

{
  "mainImageUrl": "https://upload.wikimedia.org/wikipedia/commons/6/6e/Golde33443.jpg",
  "markImageUrl": "https://1000logos.net/wp-content/uploads/2016/10/Batman-logo.png",
  "markRatio": 0.25
}
1 Like

@ian

Thank you for your repose. I follow the same exactly format for the request body but I am still getting the following error from WebServiceResponse

JSON error. Please make sure your POSTed JSON is valid: SyntaxError: Unexpected token ‘%’, “%7b%0d%0a+”… is not valid JSON

Also, When I change the advanced setting to turn off the Encode request body, It seems that I am getting return from the server but it’s Base64/Unknown format (Please check the picture below). Is that the correct value ? Shouldn’t be the URL of the generated image?

the response from the server

Capture3

Hi @kingda,

You should turn off “Encode request body”. That will send the request correctly.

The response that you’re getting is the PNG image itself. This API endpoint returns an image, not a URL.

If all you need is a URL, then you can just construct the URL directly without using “Invoke Web Service”, like so (see docs):

This URL goes straight to a PNG image.

Hope this helps!

1 Like

Thank you so much, That’s really helpful!

Can you overlay the generated image(from the constructed URL) with a text/ another image ? and generated URL for the new image?

on other word, Can you watermark the original image with two images?

Hi @kingda,

Unfortunately there isn’t a built-in way to do this. To apply a second watermark, you’d have to watermark the watermarked image.

For example:

{
  "mainImageUrl": "<insert quickchart watermarked image URL here>",
  "markImageUrl": "<second watermark URL>",
  "markRatio": 0.25
}
1 Like

Does that need to be done through API calls ?

Because the constructed URL (using the encoded URL of the watermarked image) timeout when I try to use URL for the watermarked image in the ‘mainImageUrl’ paramter.

below is the example of the constructed URL that timeout

https://quickchart.io/watermark?mainImageUrl=https%3A%2F%2Fquickchart.io%2Fwatermark%3FmainImageUrl%3Dhttps%253A%252F%252Fupload.wikimedia.org%252Fwikipedia%252Fcommons%252F6%252F6e%252FGolde33443.jpg%26markImageUrl%3Dhttps%253A%252F%252F1000logos.net%252Fwp-content%252Fuploads%252F2016%252F10%252FBatman-logo.png%26markRatio%3D0.25%0A
&markImageUrl=https%3A%2F%2F1000logos.net%2Fwp-content%2Fuploads%2F2016%2F10%2FBatman-logo.png
&markRatio=0.25

Can you please give example with real picture of the constructed URL using ‘Quickchart watermarked image URL’ ?

if you can please help me this timeout error. Thank you so much

Hi @kingda,

Apologies for the delay here. It looks like chaining watermark requests is a bit too much for the limitations of the free tier, which require that the operation completes in under 1 second.

One idea is that you could combine the two watermarks into a single watermark image, and use the API as originally outlined. Otherwise, we’d have to raise the image loading deadline, which is something that we can’t do for free plans (as there is no way to identify your request specifically).

Ian