Maya list of image formats for render globals

When setting the image format for rendering through code you have to do something like this:

from maya import cmds
# set to jpg
cmds.setAttr("defaultRenderGlobals.imageFormat", 8)

8 happens to be “jpg”
but how do you know (reliably) what the other 63 options are?
(There are 64 in my installation of Maya 2018)

Here’s how to get the default formats that ship with Maya.


from import ImageFormats
from pprint import pprint
# 'extension' is the string format. 'ident' is the int value for the enum
formatMapping = {imageDescriptor.extension: imageDescriptor.ident for imageDescriptor in ImageFormats().formats}

It took me a bit of searching through the WEBious alleyways of CG forums until I found this post:

That lead me to the answer, hopefully this saves someone some time.

This is pretty handy for UIs or doing some kind of sanity checking on rendering tools.

A bit more technical info if you want to keep reading

Run this if you want to see the python module itself.

from import createImageFormats
print createImageFormats.__file__

The code below will give you a list of ImageDescriptor objects that contain a bunch of information about the available image type, including the extension, integer identifier, description, etc.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: