# Write 16bit TiFF with vtk

**URL:** https://discourse.vtk.org/t/write-16bit-tiff-with-vtk/9029
**Category:** Support
**Created:** [July 27, 2022, 3:11pm UTC](https://discourse.vtk.org/t/write-16bit-tiff-with-vtk/9029 "2022-07-27T15:11:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![gregthom992](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gregthom992/32/7988_2.png) [@gregthom992](https://discourse.vtk.org/u/gregthom992)
#### Post date: [July 27, 2022, 3:11pm UTC](https://discourse.vtk.org/t/write-16bit-tiff-with-vtk/9029/1 "2022-07-27T15:11:31Z")

</div>

HI there,  
I have a small question and require assistance. I am required to write a .tif file at the end of my image processing pipeline; how do I go about this with vtk ?  
Currently, I am calling:  
vtkTIFFWriter writer = vtkTIFFWriter.New();  
writer.SetInput(colorMap.GetOutput());  
writer.SetFileName(“testimage.tif”);  
writer.Write();  
The result is always 8 bit tiff. Anyone knows how I can write 16 bit tif ?

Thanks

GT

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [July 28, 2022, 2:49pm UTC](https://discourse.vtk.org/t/write-16bit-tiff-with-vtk/9029/2 "2022-07-28T14:49:05Z")

</div>

Are you sure that `colorMap.GetOutput()` is giving you 16-bit data? The TIFF writer needs a 16-bit input in order to produce a 16-bit file.

Also note that `vtkLookupTable` itself produces 8-bits per component, RGB or RGBA.

---

<div class="post-metadata">

### Author: ![gregthom992](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gregthom992/32/7988_2.png) [@gregthom992](https://discourse.vtk.org/u/gregthom992)
#### Post date: [July 29, 2022, 2:26am UTC](https://discourse.vtk.org/t/write-16bit-tiff-with-vtk/9029/3 "2022-07-29T02:26:13Z")

</div>

Hi David

Thanks for your response as always. Yes, I realized that vtkLookUIpTable produces 8-bits RGB. My data is grey-scale and the only way I could make the vtk TIFF writer to work was to pass it through a vtkImageMapToColors using the vtkLookupTable. Any idea How I can spit out 16-bit RGB instead ?

Thanks

GT

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [July 29, 2022, 3:43am UTC](https://discourse.vtk.org/t/write-16bit-tiff-with-vtk/9029/4 "2022-07-29T03:43:18Z")

</div>

As far as I understand, vtkTIFFWriter should work fine with greyscale data. For 16-bit TIFF, the only requirement is that you convert your data to “unsigned short”. You can do this, for example, with vtkImageShiftScale.
