Save URI image from contacts to base64 and load in another page


Hi, I’m trying to save the profile photo of one of my contacts to a base64. I want to load this image on another screen. To load this I use nativescript-contacts which says that should return an ImageSource instance. When I print it I get this:

JS:   "photo_uri": "content://"

And when I log the base64 version I get nothing. Does anybody know what I’m doing wrong and how I could fix it? Thanks in advance!

ContactSelector.getContact().then(function (args) {
        if (args.response === "selected") {
            var con =;

            //Store image
            if( != null){
                console.log("not null!");
            } else{
                console.log("null :(");


That’s a content uri not a real file, you need a ImageSource for converting it into base64. ImageSource is usually created from bitmap or file. So you will have to find a way to convert your content uri into bitmap.


How would I convert this uri into an ImageSource or load it in my xml?
I’m new to NativeScript and can’t find any (non depricated) code to do this.