Apply a Gamma Correction


Your image or video has the wrong gamma. You need to apply a gamma correction.


Use the Draft.Image.ApplyGamma() method:

import Draft

inFile = '/path/to/input.exr'
outFile = '/path/to/output.exr'

img = Draft.Image.ReadFromFile( inFile )
img.ApplyGamma( 2.2 )
img.WriteToFile( outFile )


The gamma correction may be the opposite of what you expect. For example, the 2.2 gamma in our example will make grays darker. If you want the opposite behaviour, please use:

img.ApplyGamma( 1.0 / gamma )

Where gamma is the gamma correction you want to apply.