# How to create a vtkImageData with a three-channel matrix?

**URL:** https://discourse.vtk.org/t/how-to-create-a-vtkimagedata-with-a-three-channel-matrix/3431
**Category:** Support
**Created:** [June 1, 2020, 7:39am UTC](https://discourse.vtk.org/t/how-to-create-a-vtkimagedata-with-a-three-channel-matrix/3431 "2020-06-01T07:39:45Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![xun\_zhou](https://discourse.vtk.org/user_avatar/discourse.vtk.org/xun_zhou/32/1902_2.png) [@xun\_zhou](https://discourse.vtk.org/u/xun_zhou)
#### Post date: [June 1, 2020, 7:39am UTC](https://discourse.vtk.org/t/how-to-create-a-vtkimagedata-with-a-three-channel-matrix/3431/1 "2020-06-01T07:39:45Z")

</div>

Now i have a three-channel matrix, which represents an RGB image. I want to create a vtkImageData to store it.How can i set the properties of the vtkImageData?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [June 2, 2020, 9:05pm UTC](https://discourse.vtk.org/t/how-to-create-a-vtkimagedata-with-a-three-channel-matrix/3431/2 "2020-06-02T21:05:09Z")

</div>

You can use [vtkImageImport](https://vtk.org/doc/nightly/html/classvtkImageImport.html). Call `importer.SetNumberOfScalarComponents(3)` to import an RGB image.
