# How to get color of an Image

**URL:** https://discourse.vtk.org/t/how-to-get-color-of-an-image/3811
**Category:** Support
**Created:** [July 20, 2020, 5:04pm UTC](https://discourse.vtk.org/t/how-to-get-color-of-an-image/3811 "2020-07-20T17:04:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![beginner](https://discourse.vtk.org/user_avatar/discourse.vtk.org/beginner/32/1930_2.png) [@beginner](https://discourse.vtk.org/u/beginner)
#### Post date: [July 20, 2020, 5:04pm UTC](https://discourse.vtk.org/t/how-to-get-color-of-an-image/3811/1 "2020-07-20T17:04:17Z")

</div>

Hello everyone,

I am trying to create a colored mesh based on a png image. I see that I can use the GetProperty() function in vtkProperty class but how can I access this to get the colors pixel by pixel, to insert it into my point data? Thanks.

---

<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 21, 2020, 5:25pm UTC](https://discourse.vtk.org/t/how-to-get-color-of-an-image/3811/2 "2020-07-21T17:25:06Z")

</div>

There are two ways to color a mesh with an image.

One method is to use vtkProbeFilter, where the mesh is the Input and the image is the Source. The output will be a colored mesh, if the data coordinates are set correctly.

Another method is to use vtkTexture, if your mesh is a vtkPolyData (the vtkActor has a SetTexture method). This requires a poly data with texture coords, which can be assigned to the poly data with e.g. vtkTextureMapToPlane.

---

<div class="post-metadata">

### Author: ![beginner](https://discourse.vtk.org/user_avatar/discourse.vtk.org/beginner/32/1930_2.png) [@beginner](https://discourse.vtk.org/u/beginner)
#### Post date: [July 22, 2020, 10:27pm UTC](https://discourse.vtk.org/t/how-to-get-color-of-an-image/3811/3 "2020-07-22T22:27:05Z")

</div>

Thanks
