How to Create a Composite Image in Power Automate
Composite images are created by layering one digital image (typically with a transparent background) on top of another.
While we might associate complex composite images with a distinct artistic vision and long hours of fine-tuning in Photoshop, there’s also a practical element to simplified programmatic image compositing in day-to-day commercial use. We can composite simple images together to generate engaging, visually interesting effects that set our content apart from others.
In Power Automate, we can programmatically composite images together without needing to write any code in the process. We can use the Cloudmersive Image Processing connector to layer one transparent image file on top of another, creating our own unique visual effect.
In this article, we’ll learn how to build a simple flow in Power Automate which composites two images together from our file system.
In my example flow, I’ll composite two colorful images with transparent backgrounds, and I’ll remove the background transparency at the end of my flow.
We’ll create an instant cloud flow in this context so we can easily test our flow without external dependencies.
We’ll begin by using two Get file content actions to retrieve our image files. It doesn’t matter which order we retrieve our images in, but we’ll want to take note of which image we’re layering upon the other.
Next, we’ll add a new action and search for Cloudmersive connectors. We’re looking for the Cloudmersive Image Processing connector, which has a yellow logo.
We’ll click “See more” to view the actions list, and we’ll then search for an action called Composite two images together.
After we select this action, we’ll need to create and authorize our Cloudmersive Image Processing connection. We’ll need a free Cloudmersive API key for that, which we can get by creating a free account on the Cloudmersive website. With our free API key, we’ll be able to make up to 800 API calls per month with zero additional commitments (our API call limit will reset each month in perpetuity).
With that out of the way, we’ll begin configuring our Composite request.
This process starts with organizing our images correctly. We’ll place dynamic content for our base image in the initial file input parameter, and we’ll place dynamic content for our layered image in the Image To Layer parameter. We’ll then give each file a name (note — this does not need to be the file’s real name).
Next, we’ll turn our attention to the Location To Composite parameter. In this field, we’ll define where our layered image will appear on top of our base image.
Rather than plot our layered image on the base image’s pixel matrix, we’ll use pre-set string values to determine a general location for our layered image to land. We can use any of the following values to determine our layered image location:
center | top-left | top-center | top-right | center-left | center-right | bottom-left | bottom-center | bottom-right
In my example, I’m entering the center value. My base image is a circle which is already centered, so my layered image should land perfectly in the middle of that circle.
Now that we’ve successfully layered both images for our composite, we’ll remove the transparency from our resulting image. To do that, we’ll head back to the Cloudmersive Image Processing connector actions list, and we’ll search for an action called Remove transparency from the image.
After selecting this action, we’ll satisfy the Image file content parameter using dynamic output content from the Remove transparency action.
Now we’ll add a Create file action to save the new composite image in a folder.
After we save and test our flow, we can open our new composite image and examine its contents.
Just like that, we’ve created a simple composite image with an interesting visual effect. We can now make the most out generic transparent images without utilizing complex photo-editing software.