How to Convert Images to JPG Format in Power Automate

Cloudmersive
4 min read4 days ago

--

Power Automate is a perfect platform for making all kinds of different file format conversions. Without writing any code, we can build workflows that retrieve multiple files from one folder in our system, convert those files to a new format, and save them in a new folder with dynamic names.

In this article, I’ll walk through an example flow that converts two different images from the same folder to JPG format using a Cloudmersive Image Processing action. I’ll build an instant cloud flow in this example so I can have complete control over my data in a quick testing scenario.

In my example, I’ll be converting two different image files from the same OneDrive for Business folder — one PNG file and one WebP file — to JPG format.

To bring these files into my flow, I’ll add a OneDrive for Business connector action called List files in folder and select the folder my image files are saved in. This action returns file IDs for each file in my selected folder (along with some other useful metadata).

Next, I’ll add a Get file content action from the OneDrive for Business connector. This allows me to load image file bytes using the file IDs I retrieved with the List files in folder action. Because my operation involves multiple files, Power Automate automatically wraps my Get file content action in a For each control.

Within the For each control, I’ll add a new action and search for Cloudmersive connectors. I’m looking for the Cloudmersive Image Processing connector with the yellow logo.

After I click “See more” to view the actions list, I’ll search for an action called Convert input image to JPG, JPEG format and select it.

I’ve already authorized my connection, so I’ll jump straight to the request parameters after selecting this action. If it’s your first time using this connector, you’ll need to create our connection with a free Cloudmersive API key before you can begin configuring your request. Free API keys provide up to 800 API calls per month with zero commitments.

To configure my request, I’ll first set the compression level for my new JPG images to 75 (highest compression = 1 and lowest compression = 100) in the initial compression parameter, and I’ll then supply my image file bytes and file names as dynamic content from the Get file content and List files in folder actions.

In the final step of my flow, I’ll add a Create file action within the For each control that writes the JPG file bytes from my conversion to new .jpg image files in a separate OneDrive for Business folder. In this example, I’ve named my files using the original Name values returned by the List files in folder action, but I’ve trimmed the original file extensions (e.g., .png and .webp ) using the Slice function (this avoids creating files with double extensions).

After I save and test my flow, I’ll find my new JPG image files in a separate folder from the original PNG and WebP images. All done!

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.