Skip to main content
Solved

Dynamically adjust contrast or gamma in rasters

  • April 8, 2026
  • 4 replies
  • 102 views

james_c_452
Enthusiast
Forum|alt.badge.img+10

Hi,
I have several rasters that are quite dark, I’d like to brighten them. I can do this automatically in another software, but this involves me setting up a script (I use mogrify).
I’d like to do this in FME, but I have never been able to work it out. I have tried several things over the years. The best I’ve been able to do dynamically is make the image better, but then the colours go all strange. I want to keep them close to real like. Here is an example of a dark image.
I don’t think the images have a consistent correction that should be applied, which is why I want it to treat each image individually.
Any help would be great thanks
 

 

Best answer by ali-safe

Hi ​@james_c_452; thank you for posting your question.

I appreicate you detailing what your use-case is and what you have tried to the best of your ability - this is helpful.

Back to your question, what you are describing here could be achived by heading over to FME Hub and using the ImageColorAdjuster. This should allow you to correct the images you have. Do let us know if you need some asstiance with using it or if it doesn’t work out, or really anything else releated to your question.

Best,

4 replies

ali-safe
Safer
Forum|alt.badge.img+24
  • Safer
  • Best Answer
  • April 13, 2026

Hi ​@james_c_452; thank you for posting your question.

I appreicate you detailing what your use-case is and what you have tried to the best of your ability - this is helpful.

Back to your question, what you are describing here could be achived by heading over to FME Hub and using the ImageColorAdjuster. This should allow you to correct the images you have. Do let us know if you need some asstiance with using it or if it doesn’t work out, or really anything else releated to your question.

Best,


james_c_452
Enthusiast
Forum|alt.badge.img+10
  • Author
  • Enthusiast
  • April 19, 2026

Hi ​@ali-safe ,

The ImageColourAdjuster does seem to change the gamma. Though I do want it to be more on an image by image basis. I couldn’t see a way to do this.

So what I did was use this to convert the image to black and white and then get the overall average brightness of the image. I used this to get a gamma value. Then I applied this gamma value back to the original image using the ImageColourAdjuster again.

I didn’t know this transformer existed now thanks. My company only just upgraded from 2023 to 2025 and I hadn’t found it yet


ali-safe
Safer
Forum|alt.badge.img+24
  • Safer
  • April 20, 2026

Hi ​@james_c_452,

Thanks for letting me know that it worked for you. I’m glad that it did. I appreiciate your feedback you gave here.

Ah I see, thanks or telling me the process to correct the gamma on your image. I’ll note your use of the transformer and see if we can integrate something like this.

No problem, it is one that needs to be downloaded off FME Hub.


james_c_452
Enthusiast
Forum|alt.badge.img+10
  • Author
  • Enthusiast
  • April 21, 2026

What I did to each image, after turning it to black and white, to calculate the ideal gamma correction was to run the raster statistics calculator to get the average black and white value of band 0, as well as the maximum value. My images are panoramas, so they have black bars. I made sure to set colour 0 to no data before I computed the average.

I normalised the average (mean/max) to correct it if it doesn’t cover the full range. 

Then I used this normalised average in the gamma caluclation. I did log(0.5)/log(NormalisedAverage) to calculate a gamma. I removed geometery and attributes (except or the gamma and the basename) and merged back onto the original image, and then I applied the gamma

I’ve no idea if this is the best process, but it seems to do what I want (brighten dark laser scan panoramas without over exposing them)