Apply a Gamma Correction¶
Problem¶
Your image or video has the wrong gamma. You need to apply a gamma correction.
Solution¶
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 )
Discussion¶
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.