Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 1QYRF0Mpsxcagbu4WV6bux
Power Automate - Building Flows
Answered

Create image from Base64

Like (0) ShareShare
ReportReport
Posted on 3 Oct 2022 15:10:40 by 86

I'm trying to create an image in Sharepoint based on the Base64 encoded data which I have received in JSON format.

 

This Base64 comes in as:

 

data:image/png;base64,iVBORw0KGgoAAAANSUh...

 

If I use DecodeBase64ToBinary on this, I get the error

The template language function 'base64ToBinary' was invoked with a parameter that is not valid. The value cannot be decoded from base64 representation.'.

 

However, if I remove 

 

data:image/png;base64,

 

from the start of the data, it works fine.

I thought this was needed as part of the Base64 data? It would be a pain if I have to remove it in order to decode it. 

  • ctrl_kudorje Profile Picture
    141 on 17 Apr 2025 at 18:21:14
    Create image from Base64
    what about if the data is in PDF and starts like this? 
    JVBERi0xLjMKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiA
  • DuncanIVH Profile Picture
    86 on 04 Oct 2022 at 08:48:05
    Re: Create image from Base64

    Thanks @v-xiaochen-msft 

    I could have sworn I'd tried that already, but that fixed it!

  • Verified answer
    v-xiaochen-msft Profile Picture
    on 04 Oct 2022 at 02:41:20
    Re: Create image from Base64

    HI @DuncanIVH ,

     

    Please use datauritobinary instead of base64tobinlary if the string has a head like 'data:....'

     

    Best Regards,

    Wearsky

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,745 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
Loading complete