# Creating a VTP PolyData output file with color assignments

**URL:** <https://discourse.vtk.org/t/creating-a-vtp-polydata-output-file-with-color-assignments/13851>\
**Category:** Development\
**Created:** [May 6, 2024, 4:11pm UTC](https://discourse.vtk.org/t/creating-a-vtp-polydata-output-file-with-color-assignments/13851 "2024-05-06T16:11:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![spenshel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b9bd4f/32.png) [@spenshel](https://discourse.vtk.org/u/spenshel)\
**Post date:** [May 6, 2024, 4:11pm UTC](https://discourse.vtk.org/t/creating-a-vtp-polydata-output-file-with-color-assignments/13851/1 "2024-05-06T16:11:31Z")

</div>

I’m trying to create a VTP PolyData output file with cell data scalars that represent RGB color values. Is there a way to do this without having to create a color mapper, which I apparently can’t do without an actor object? I’m not trying to visualize the data, I’m just trying to create the VTP file.

---

<div class="post-metadata">

**Author:** ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)\
**Post date:** [May 6, 2024, 4:18pm UTC](https://discourse.vtk.org/t/creating-a-vtp-polydata-output-file-with-color-assignments/13851/2 "2024-05-06T16:18:21Z")

</div>

Sure, you can create a three component array and store the RGB values there.

---

<div class="post-metadata">

**Author:** ![spenshel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b9bd4f/32.png) [@spenshel](https://discourse.vtk.org/u/spenshel)\
**Post date:** [May 6, 2024, 8:00pm UTC](https://discourse.vtk.org/t/creating-a-vtp-polydata-output-file-with-color-assignments/13851/3 "2024-05-06T20:00:47Z")

</div>

I tried that by setting the CellData of the vtkPolyData object to an array of RGB triples. However, when I loaded it into Paraview, it interpreted the values as X-Y-Z vectors instead of RGB triples, and used the magnitudes of these “vectors” as indices into a default color map. There appeared to be no way from within Paraview to interpret the RGB triples as colors.

---

<div class="post-metadata">

**Author:** ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)\
**Post date:** [May 7, 2024, 7:22am UTC](https://discourse.vtk.org/t/creating-a-vtp-polydata-output-file-with-color-assignments/13851/4 "2024-05-07T07:22:08Z")

</div>

> [@spenshel](#):
>
> There appeared to be no way from within Paraview to interpret the RGB triples as colors.

Uncheck “MapScalars” in the advanced display properties in the scalar coloring section.

 ![a](https://discourse.vtk.org/uploads/default/original/2X/0/0fe353d28c1244a1621b739482a88c4016d5bb65.png)

But this is VTK discourse and you stated: “I’m not trying to visualize the data, I’m just trying to create the VTP file.”

---

<div class="post-metadata">

**Author:** ![spenshel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b9bd4f/32.png) [@spenshel](https://discourse.vtk.org/u/spenshel)\
**Post date:** [May 7, 2024, 1:54pm UTC](https://discourse.vtk.org/t/creating-a-vtp-polydata-output-file-with-color-assignments/13851/5 "2024-05-07T13:54:54Z")

</div>

Thanks, that did the trick.
