How to use Base64 png Images with nativeImage


#1

Afternoon Everyone,

I’m new to Electron and I’m playing with a few ideas to replace some of our client side tools. We have one application that we populate a context menu with user defined items. With each item the user was able to add an png image to customize it, to help store it we converted the file to a base64 string.

After reading through the Electron API, I can read a local file with no issue but i can seem to find a way to take a base64 string and convert it to an image for electron to use. Does electron have this functionality? if so can someone help point me in the right direction to figure this out?


#2

nativeImage.createFromDataURL seems to be what you need.


#3

Sorry for the delay in response. This did help me and I was able to get it figured out.