# Extract color information per vertex

**URL:** https://discourse.vtk.org/t/extract-color-information-per-vertex/940
**Category:** Support
**Created:** [May 10, 2019, 12:16am UTC](https://discourse.vtk.org/t/extract-color-information-per-vertex/940 "2019-05-10T00:16:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bingjian](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/43a26b/32.png) [@bingjian](https://discourse.vtk.org/u/bingjian)
#### Post date: [May 10, 2019, 12:16am UTC](https://discourse.vtk.org/t/extract-color-information-per-vertex/940/1 "2019-05-10T00:16:21Z")

</div>

I have a quick question about reading the color information stored in a ply file.

The following code extracts the xyz coordinate of a given vertex, but how to read the RGB value associated to each vertex?

vtkSmartPointer reader = vtkSmartPointer::New();

reader-\>SetFileName(“input\_with\_color.ply”);

reader-\>Update();

vtkSmartPointer polyData = reader-\>GetOutput();

vtkSmartPointer vertices = polyData-\>GetPoints();

double xyz[3];

vertices-\>GetPoint(idx, xyz);

I guess we can use

polyData-\>GetPointData()-\>GetArray("???")

but not sure how to do that. Would appreciate any pointers or examples!

Thanks,  
Bing

---

<div class="post-metadata">

### Author: ![Jone7](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/e36b37/32.png) [@Jone7](https://discourse.vtk.org/u/Jone7)
#### Post date: [November 11, 2020, 11:13am UTC](https://discourse.vtk.org/t/extract-color-information-per-vertex/940/2 "2020-11-11T11:13:12Z")

</div>

hello，I also met a similar problem. How did you solve it ?
