You can use picture formatter to dynamically insert pictures into PPTX documents.
There are some steps you need to do to use the piсture tag. Let’s take a look.
Firstly, I insert a dummy picture to the template.
Then I place the picture tag into AltText section of the dummy image.
{{image}:picture}
Note
Resizing of the image is not supported for PPTX templates yet.
After I run the Microsoft flow, the dummy picture will be replaced with a real one.
The formatter accepts URLs. The URL must be publicly anonymously available (no authentication).
For the template from the picture above to work you need to use JSON object like this:
{
"publicUrl": "https://plumsail.com/docs/documents/v1.x/_images/plumsail-logo.png"
}
Also, the formatter supports Base64 strings as pictures. Thus, for the template from the picture above to work you will need to pass something like this:
{
"base64String": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIoAAAAyCAYAAACDHkN8AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH5AYDDA8z7aYtxwAACOdJREFUeJztnG9sE/cZx79JuByJTVKKXajjkhSnEknAFgxthKglVdaQjgotlaq9AaSplVZ4NQl4OQ3EqxVV24uJPxLbC4I0oTCYMpgWV5Q0IwTU/JkNdgjxQZy4dpwzJJc4di7nP3vh2LNjOzn77pcSdB/JSnz3u9/z2P7e83ue584uiEajUSgorEDhj+2AwtpAEYqCKNaRNtDzVxvGBiZRsVMDQ4MOFTs2kTapQADiQhHmw5gYnsLE8BT6r4+gtrkS9UdrULa5lLRpBRkhvvQI86GU53azE+0nuvG0+wfSphVkZBWEEk7bNuMN4PbZh4pY1hDEhRLiQ1n33T77EI4eN2kXFGTgR4koydy7/BizkwHSbihIhLhQgtP8svunXH7cu2wj7YaCRIgLZdozt+KYJ3fH8ej2c9KuKEiAqFACUzyEYPYcJRlFKK82RIUy7fGLHusdmVbE8gpDVCice+VlJxlFKK8uZIUiIj9JxjsyDY/9JSFvFKRAVCgTT6ZyPsYzpAjlVYSsUIZz/9A99hcEPInhsrDoOP0ALgtLzMZawGZ24i9H/p3TMcQuCnKeOQS5hZyPExtReL8A9hmXtp1WUdAayjMeM27xgelxY3erIWe/1iosw4FWUykXYe2dTsxM5NbkJCaUie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jaUo+Sg7eIzK0gD6KT2WhwEiHHNQgj1xCZkre5U9JyHUUVH8o6p4K85F71RCMQHNcQGrmGsCf7XfBioXYcB/2zs5LnUSBL3n0UAAi7vkXY24vwROyRK1TtF6Dr/5CveYVVRJJQkokucAh7ehD29CDC9iEyO4ZoMPMtkYUbt4Oq/QLU9l/LYVphFZBNKAqvN8ovVyuIQhGKgigUoSiIQhGKgigUoSiIQhGKgij+B4V7vYMAPildAAAAAElFTkSuQmCC"
}
You can insert any image if you can get its Base64 code in Power Automate flow or even using some third-party services.
Let’s check out the next example.
I download the PPTX template and the Image from OneDrive folder. The PPTX template was prepared as described in the previous part of the article.
Then I add the action Create PPTX document from template to my flow.
I use this code in the JSON to convert the uploaded image into base64 format:
base64(body('GetImage'))
This is the resulting PPTX file
You can download the PPTX template here.