# getImageFromBase64 sample please

**URL:** <https://forums.fusetools.com/t/getimagefrombase64-sample-please/6634>\
**Category:** How-to Discussions\
**Created:** [July 18, 2016, 5:39pm UTC](https://forums.fusetools.com/t/getimagefrombase64-sample-please/6634 "2016-07-18T17:39:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elmer\_Salazar](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/elmer_salazar/32/181_2.png) [@Elmer\_Salazar](https://forums.fusetools.com/u/Elmer_Salazar)\
**Post date:** [July 18, 2016, 5:39pm UTC](https://forums.fusetools.com/t/getimagefrombase64-sample-please/6634/1 "2016-07-18T17:39:51Z")

</div>

Some example of using Img Tools to display image based 64 with getImageFromBase64

Thanks for your help

---

<div class="post-metadata">

**Author:** ![Edwin\_Reynoso](https://avatars.discourse-cdn.com/v4/letter/e/e99b99/32.png) [@Edwin\_Reynoso](https://forums.fusetools.com/u/Edwin_Reynoso)\
**Post date:** [July 20, 2016, 12:58am UTC](https://forums.fusetools.com/t/getimagefrombase64-sample-please/6634/2 "2016-07-20T00:58:01Z")

</div>

I haven’t tested this but I think I may have an idea of how it works:

```auto
<JavaScript>
var file = Observable('Assets/Image.png');
var data = // let's say this is your base64 code, idk how you're getting it but you somehow got it either from fetch or whatever

module.exports = {
    file: file,
    click: function() {
        ImageTools.getImageFromBase64(data).then(function(base64Image) {
            file.value = base64Image;
        });
    }
}
</JavaScript>
<Panel>
    <Image File="{file}" />
    <Button Text="Get Pic" Clicked="{click}" />
</Panel>

```

Let me know if that works please

---

<div class="post-metadata">

**Author:** ![Anders\_Bondehagen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_bondehagen/32/98_2.png) [@Anders\_Bondehagen](https://forums.fusetools.com/u/Anders_Bondehagen)\
**Post date:** [July 20, 2016, 9:21am UTC](https://forums.fusetools.com/t/getimagefrombase64-sample-please/6634/3 "2016-07-20T09:21:26Z")

</div>

What are you trying to do? You are not supposed to display images with `ImageTools`.

---

<div class="post-metadata">

**Author:** ![Elmer\_Salazar](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/elmer_salazar/32/181_2.png) [@Elmer\_Salazar](https://forums.fusetools.com/u/Elmer_Salazar)\
**Post date:** [July 20, 2016, 9:28am UTC](https://forums.fusetools.com/t/getimagefrombase64-sample-please/6634/4 "2016-07-20T09:28:34Z")

</div>

I try to display a base64 image obtained from an RESTful API, any idea how to do it?

---

<div class="post-metadata">

**Author:** ![Andreas\_Ronning](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/andreas_ronning/32/303_2.png) [@Andreas\_Ronning](https://forums.fusetools.com/u/Andreas_Ronning)\
**Post date:** [July 26, 2016, 10:36am UTC](https://forums.fusetools.com/t/getimagefrombase64-sample-please/6634/5 "2016-07-26T10:36:10Z")

</div>

Hey

`getImageFromBase64` returns a promise of an image object. One of the fields on the image object is “path”.

```auto
ImageTools.getImageFromBase64(base64String).then(
    function(image) { 
        //Display image using image.path here, for instance by binding to UX Image File attribute 
    }
)

```
