How to use Base64 png Images with nativeImage


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?


nativeImage.createFromDataURL seems to be what you need.


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


hi @zacharyshupp can you give some snippet on how you solve this problem? I’m having a hard time solving this. Thanks a lot.