Convert a QuickTime’s Color Space


You have a QuickTime movie that is not in the desired color space. For example, the QuickTime file has linear color but you want sRGB instead.


Use the Draft.LUT class:

import Draft

inFile = '/path/to/'
outFile = '/path/to/'

dec = Draft.VideoDecoder( inFile )
enc = Draft.VideoEncoder( outFile, dec.fps, dec.width, dec.height )

lut = Draft.LUT.CreateSRGB()

img = Draft.Image.CreateImage( 1, 1 )

while dec.DecodeNextFrame( img ):
    lut.Apply( img )
    enc.EncodeNextFrame( img )



In our script above, two lines are repsonsible for performing the color conversion. First, we call Draft.LUT.CreateSRGB() to create the LUT. The returned LUT will convert images from Linear color to sRGB.

Next, we call Apply() to apply our LUT to every frame in the movie before we encode it into our output movie.

Draft includes several LUTs in addition to sRGB:

LUT Draft command
Cineon Draft.LUT.CreateCineon()
Alexa V3 Log C Draft.LUT.CreateAlexaV3LogC()
sRGB Draft.LUT.CreateSRGB()
Rec. 709 Draft.LUT.CreateRec709()
Gamma correction Draft.LUT.CreateGamma()

See Also

For the inverting a LUT please review Bake a Color Transform.