Quick Tip: Setting The Render Image Format in Maya

To set the render image format to OpenEXR you need to set both the imageFormat and imfkey in defaultRenderGlobals. Setting the imageFormat to 51 means that you are going to use a custom image format like Tiff Uncompressed (tif), hdr, exr, Zpic, picture, ppm, ps etc.. and than you set the imfkey to whatever format you want, in my case I set it to 'exr'

from pymel import core as pm
dRG = pm.PyNode('defaultRenderGlobals')
dRG.setAttr('imageFormat', 51)
dRG.setAttr('imfkey', 'exr')
Edit: Also you can set the compression to ZIP ("Zip (1 scanline)" in Nuke terms) by:
mrG = pm.PyNode("mentalrayGlobals")
mrG.setAttr("imageCompression", 4)

Comments