# \[vtk.js\] Add logo to render view

**URL:** https://discourse.vtk.org/t/vtk-js-add-logo-to-render-view/4068
**Category:** Web
**Created:** [August 25, 2020, 3:44pm UTC](https://discourse.vtk.org/t/vtk-js-add-logo-to-render-view/4068 "2020-08-25T15:44:31Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [August 25, 2020, 3:44pm UTC](https://discourse.vtk.org/t/vtk-js-add-logo-to-render-view/4068/1 "2020-08-25T15:44:31Z")

</div>

I’m curious if there is an easy way to add a logo/icon to the top right of the vtk.js render window.

Would I do something like (I’m not getting this to work):

```auto
...

import style from './controller.css';
import icon from './logo.png';

...
const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance();
...

const container = fullScreenRenderer.getContainer();
const logo = new Image();
logo.src = icon;
logo.setAttribute('class', style.logo);
container.appendChild(logo);

```

with a style file containing:

```css
.logo {
  position: absolute;
  top: 5px;
  right: 5px;
  height: 2.0em;
  width: 2.0em;
  cursor: pointer;
  z-index: 100;
}

```

---

<div class="post-metadata">

### Author: ![Forrest](https://discourse.vtk.org/user_avatar/discourse.vtk.org/forrest/32/300_2.png) [@Forrest](https://discourse.vtk.org/u/Forrest)
#### Post date: [August 25, 2020, 4:24pm UTC](https://discourse.vtk.org/t/vtk-js-add-logo-to-render-view/4068/2 "2020-08-25T16:24:36Z")

</div>

Do you have a loader that loads `logo.png` into a data uri? (I think url-loader does this.)

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [August 25, 2020, 4:26pm UTC](https://discourse.vtk.org/t/vtk-js-add-logo-to-render-view/4068/3 "2020-08-25T16:26:54Z")

</div>

Yep, I’m using webpack to bundle it and I have url-loader in the rules

```auto
{ test: /\.(png|jpg)$/, use: 'url-loader?limit=81920' },

```

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [August 25, 2020, 4:35pm UTC](https://discourse.vtk.org/t/vtk-js-add-logo-to-render-view/4068/4 "2020-08-25T16:35:10Z")

</div>

The image has made it in, but perhaps the style isn’t being applied/it is not showing in the correct place:

 ![Screen Shot 2020-08-25 at 10.34.22 AM](https://discourse.vtk.org/uploads/default/original/2X/a/addc16f89894f26b1465530053f4faa86979a5df.png)

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [August 25, 2020, 4:41pm UTC](https://discourse.vtk.org/t/vtk-js-add-logo-to-render-view/4068/5 "2020-08-25T16:41:16Z")

</div>

Aha, yep. I can confirm that the above code works, just the style is not being applied for some reason. Manually adjusting the style does the trick

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [August 25, 2020, 4:56pm UTC](https://discourse.vtk.org/t/vtk-js-add-logo-to-render-view/4068/6 "2020-08-25T16:56:17Z")

</div>

In case someone else stumbles upon this and needs a way to easily embed a logo, this works:

```auto
const container = fullScreenRenderer.getContainer();
const linker = document.createElement('a');
linker.target = '_blank';
linker.href = 'http://www.kitware.com/';
const logo = new Image();
logo.src = icon;
logo.style.position = 'absolute';
logo.style.top = '25px';
logo.style.right = '25px';
logo.style.height = '75px';
logo.style.cursor = 'pointer';
linker.appendChild(logo);
container.appendChild(linker);

```

Though it’d be great to have the CSS handle the styling…

---

<div class="post-metadata">

### Author: ![Forrest](https://discourse.vtk.org/user_avatar/discourse.vtk.org/forrest/32/300_2.png) [@Forrest](https://discourse.vtk.org/u/Forrest)
#### Post date: [August 25, 2020, 5:45pm UTC](https://discourse.vtk.org/t/vtk-js-add-logo-to-render-view/4068/7 "2020-08-25T17:45:42Z")

</div>

Oh, `style.logo` is undefined, so make sure your CSS is being imported correctly.
