After some research online, found that this is due to the image path get converted into base64 string. And in order to allow a proper path to be saved, the base64 string need to be decoded back into normal human readable string. This can be achieved by using atob(). Please refer to
Window atob() Method[
^]. Thank you Iw@zi for your help. May this suggestion will help other who need it.