.. _ColorOperations/CreateCineonImagesFromEXRImages:

Create Cineon Images from EXR Images
====================================

Problem
-------

You have a linear color .EXR image, and you want to create a Cineon .DPX image from it.

Solution
--------

You can use the following script::

    import Draft

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

    lut = Draft.LUT.CreateCineon()
    img = Draft.Image.ReadFromFile( inFile )
    lut.Apply( img )
    img.WriteToFile( outFile )

Discussion
----------

By default, Draft writes linear DPX files.  To create a DPX file with Cineon color, we must create a Cineon LUT and apply it to the image before we :meth:`~Draft.Image.WriteToFile`.  This line creates a Cineon LUT::

    lut = Draft.LUT.CreateCineon()

And this line applies the LUT to our image::

    lut.Apply( img )