Skip to main content
Question

GeoTiff change RGB values

  • May 24, 2019
  • 3 replies
  • 75 views

Hello,

I have some pixels of my GeoTiff file who have this RGB combination (255,255,255). I want to replace these pixel values by (0,0,0).

But I don't want a replacement of pixels who have just one or two values with 255, (67,255, 255) stay (67,255,255).

I have start with this :

I have separate my 3 bands (RGB) with the RasterSelector, and I have apply RasterCellValueReplacer on each band. But, I wonder how to do the replacement only if the pixel has the value 255 on each band (RGB).

Thanks a lot,

Joc

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

jdh
Contributor
Forum|alt.badge.img+37
  • Contributor
  • 2002 replies
  • May 24, 2019

All you need is a single RasterExpressionEvaluator and a conditional statement

 

 

if (A[0]==255 && A[1]==255 && A[2]==255, 0, A[i])

 

set the A[i] as appropriate for each band.

  • Author
  • 1 reply
  • May 24, 2019

Thank you @jdh. I have try the statement but I have a syntax problem :

 


jdh
Contributor
Forum|alt.badge.img+37
  • Contributor
  • 2002 replies
  • May 24, 2019

Thank you @jdh. I have try the statement but I have a syntax problem :

 

You need to replace the i in A[i].

 

 

So for the red band it would be A[0], for the Green band it would be A[1]...