Skip to main content

Notifications

Community site session details

Community site session details

Session Id : dO1ng9QRMchscv3KdUyVEs
Power Automate - General Discussion
Answered

Convert Image to Base64 in Power Automate

Like (0) ShareShare
ReportReport
Posted on 4 Nov 2021 18:00:23 by 22

I have a Power Automate action that requires an image in base64. Is there a way to convert a given image to base64 using Flow via an action or Expression builder?

  • jt_michels Profile Picture
    2 on 11 Nov 2023 at 09:01:10
    Re: Convert Image to Base64 in Power Automate

    I know this has been a while, but wanted to respond in case you needed it.  The contentBytes is indeed the base64 for your image.  i.e. to view it you could enter it as a data URI for an image as data URI with the format data:[contentType]/[format];base64,{contentBytes} so for your png image:

     

    "data:image/png;base64,{contentBytes}"

     

     

  • Nantoanina Profile Picture
    11 on 01 Jun 2023 at 11:58:17
    Re: Convert Image to Base64 in Power Automate

    Hello,

     

    I have same issue but my image is from PowerApps 

    I try same function but i alwayse get data like below

     

    Nantoanina_0-1685620596158.png

     

    If you have any idea how to get "contentBytes" ??

     

  • wael_khanji Profile Picture
    151 on 31 Dec 2022 at 17:58:16
    Re: Convert Image to Base64 in Power Automate

    Hi 

    there is any way to know the size image ?? 

    I mean to avoid failed action if the size is more than 28Kb

     there is any expression use it on condition if size more than 28 don't use it 

  • CFernandes Profile Picture
    8,283 Most Valuable Professional on 04 Nov 2021 at 19:09:53
    Re: Convert Image to Base64 in Power Automate

    @jokanol1 I am glad that your problem is resolved.😊

  • jokanol1 Profile Picture
    22 on 04 Nov 2021 at 18:51:06
    Re: Convert Image to Base64 in Power Automate

    It worked, thanks!

  • Verified answer
    CFernandes Profile Picture
    8,283 Most Valuable Professional on 04 Nov 2021 at 18:42:12
    Re: Convert Image to Base64 in Power Automate

    Hey Mate @jokanol1 

     

    You can use the Expression - base64(<your file content>)

     

    CFernandes_0-1636051239053.png

     

    If you are getting content from a SharePoint the you direct convert it  - using the formula -

     

     

    CFernandes_0-1636051656266.png

     

    outputs('Get_file_content_using_path')?['body']?['$content'] 
     
    CFernandes_1-1636051702024.png

     

     

    https://flow.microsoft.com/en-us/blog/use-expressions-in-actions/#:~:text=To%20use%20an%20expression%20in,See%20more%20on%20each%20category

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,751 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started