Load JPEG from URL into a texture in vtk.js

(Donny Zimmerman) #1

I have searched the vtk.js API and examples and I am unable to find out how to load a vtkTexture from a JPEG image retrieved from a URL. Similar to vtkJPEGReader in standard VTK. Any help would be appreciated.

(Sebastien Jourdain) #2
const img = new Image();
img.src = 'http://url/to/your/image.jpg';

const texture = vtkTexture.newInstance();
(Donny Zimmerman) #3

Thanks Sebastien! That was much simpler than I thought! I am really excited about using VTK.js and will try to help contribute to the examples when I can.

1 Like